我需要一个批处理文件,它将执行以下操作:
1. Open CMD and navigate to a location C:/Users/...../program.exe
2. Run the program.exe with an additional command to point it to a config file:
e.g. "program.exe C:/Users/..../configFile.bgi"
我怎样才能做到这一点?
我尝试了这个,但是没有运气:
start "C:\Users\Ben\Desktop\BGInfo\bginfo.exe C:\Users\Ben\Desktop\BGInfo\dc_bginfo.bgi"
pause
更新
我使用了Ganesh(如下)提供的解决方案,并提出了以下解决方案:
cd C:\Users\Ben\Desktop\BGInfo\
bginfo.exe C:\Users\Ben\Desktop\BGInfo\dc_bginfo.bgi
我已经在本地计算机(更改目录)上对其进行了测试,但是在服务器(具有以上目录)上却无法工作...
具有批处理文件的文件夹目录:
错误
最佳答案
在批处理文件abc.bat中
cd c:\user\ben_dchost\documents\
executible.exe -flag1 -flag2 -flag3
我假设您的
executible.exe
存在于c:\user\ben_dchost\documents\
中我还假设它需要的参数是
-flag1
-flag2
-flag3
编辑:
对于您说要执行的命令,请执行以下操作:
cd C:\Users\Ben\Desktop\BGInfo\
bginfo.exe dc_bginfo.bgi
pause
希望这可以帮助
关于batch-file - 创建批处理文件以运行带有附加参数的.exe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27901042/