batch-file - 创建批处理文件以运行带有附加参数的.exe

标签 batch-file cmd

我需要一个批处理文件,它将执行以下操作:

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/

相关文章:

Excel VBA CMD 列出目录内容

batch-file - 批处理文件 ErrorLevel 问题

Windows 批处理文件 - 批处理文件在需要一段时间才能完成的命令后停止执行

python - 从 cmd Python 运行 Anaconda 环境

java - 从 cmd 运行代码时出现错误 : package org. apache.log4j 不存在

windows - 查询过去两周的windows事件日志

windows - 如何在 windows 2012 服务器中终止特定任务

windows - 永久设置环境路径

batch-file - 如何删除超过 X 小时或分钟的文件?

windows - 批处理 : How to run a program when the computer is idle and stop when it's used?