Different Command prompt windows does not executin

2019-08-04 00:20发布

问题:

I've two command prompt windows as follow,

  1. Administrator:Command Prompt -- Opened manually

--

  1. Administrator:C:\Windows\System32\cmd.exe -- open by C# code (Process.Start)

I'm trying to execute svn command, i.e consider svn update command.

This command executed successfully in the 1st cmd, which I opened manually. But the same command does not executing in the 2nd cmd window, which is opened by C# code.

Giving the error as "svn" is not recognized as internal or external command

I want this to trigger from code. Checked path variables. Created a bat file to execute commands. The same error remains, executing the bat manually works while from code doesn't.

Why the cmd acts differently?

回答1:

You say that you checked the %PATH% variable, but you didn't say anything about how you checked it and what the result was. What do you get when you run echo %PATH% in the 2nd command window?

Given the error message it's almost certain that the path to the svn executable is missing from your %PATH%. Try the following:

set PATH=%PATH%;C:\path\to\svn\dir
svn update


标签: svn cmd