如何从命令行中的任何地方运行.exe [英] How to run .exe from anywhere in commandline
问题描述
大家好,
我有winform .exe,其中有几个相关的引用文件(其他dll,app.config,.ini等).也可以使用某些参数在命令行中访问此.exe.现在,我该如何制作.exe,使最终用户可以从命令行中的任何位置访问它. 例如 c:\> MyExe.exe .即使实际的.exe位于" C://Program Files/myCompany/myexe.exe "中. (目前,如果用户使用"cd Programfiles"->输入整个路径或转到实际的应用程序文件夹,则此方法工作正常. "cd myCompany".)
I have winform .exe which has several dependent referenced files (other dlls,app.config,.ini etc.). This .exe can also be accessed in commandline using some arguments. Now How could I make .exe in such a way that end-user can access it from anywhere in commandline e.g. c:\> MyExe.exe. eventhough actual .exe resides at "C://Program Files/myCompany/myexe.exe". (Right now it works fine if the user types entire path or goes to actual application folder using "cd Programfiles" --> "cd myCompany".)
我不确定这是否可行?我认为实际的源代码对此无能为力.
I am not sure whether this is possible or not? I do not think actual source code can do anything regarding this.
谢谢
推荐答案
您可以将程序的路径添加到PATH环境变量中:
You could add your program's path to the PATH environment variable:
http: //www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/path.mspx?mfr=true
这篇关于如何从命令行中的任何地方运行.exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!