问题描述
嗨。
我有一个控制台应用程序,我尝试在PATH构建环境中添加一个目录。
I have a console application in which I try to add a directory to the PATH build environment.
代码:
然后,在上面的代码存在之后我尝试运行命令行:
And then, after the above code is existed I try to run a command line:
VSIXInstaller.exe / q / f C:\安装\ Editor.vsix
VSIXInstaller.exe /q /f C:\Installations\Editor.vsix
问题是,我收到错误消息,说明VSIXInstaller.exe无法识别,但运行控制台应用程序后,我没有遇到此错误消息,并且命令按预期执行。
The problem, I get ab error message which says that VSIXInstaller.exe is not recognized, but after I run the console application, I don't face this error message and the command executed as expected.
你能帮忙吗?
最好的问候,
Nadeem Bader
Best Regards,
Nadeem Bader
推荐答案
您需要包括路径和可执行文件名称,例如(以下路径可能与您的计算机不同)
You need to include the path and the executable name e.g. (the path below may differ on your machine)
" C:\Program Files(x86)\ Microsoft Visual Studio 14.0 \ Common7 \IDE \VSIXInstaller.exe" VSIXInstaller.exe / q / f C:\安装\ Editor.vsix
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\VSIXInstaller.exe" VSIXInstaller.exe /q /f C:\Installations\Editor.vsix
使用它可能更容易
Directory.SetCurrentDirectory 到上面的路径,运行命令或使用Process.Start与
。
It might be easier to use Directory.SetCurrentDirectory to the path above, run the command or use Process.Start withProcessStartInfo.
这篇关于控制台应用程序 - 将目录添加到PATH环境变量 - 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!