创建一个批处理文件以运行带有附加参数的.exe [英] Create a batch file to run an .exe with an additional parameter

查看:233
本文介绍了创建一个批处理文件以运行带有附加参数的.exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个可以执行以下操作的批处理文件:

I need a batch file which will do the following:

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"

我该怎么做?

我尝试了这个,但是没有运气:

I tried this but with no luck:

start "C:\Users\Ben\Desktop\BGInfo\bginfo.exe C:\Users\Ben\Desktop\BGInfo\dc_bginfo.bgi"
pause

更新

我使用了Ganesh(如下)提供的解决方案,并提出了以下解决方案:

I've used the solution provided by Ganesh (below) and came up with this:

cd C:\Users\Ben\Desktop\BGInfo\
bginfo.exe C:\Users\Ben\Desktop\BGInfo\dc_bginfo.bgi

我已经在本地计算机(更改目录)上对其进行了测试,但是在服务器(具有以上目录)上却无法正常工作...

I've tested it on a local machine (changing the directories) but on the server (with the directory above) it does not work...

带有批处理文件的文件夹目录:

The folder directory with batch file:

错误

推荐答案

在批处理文件abc.bat

in batch file abc.bat

cd c:\user\ben_dchost\documents\
executible.exe -flag1 -flag2 -flag3 

我假设您的executible.exec:\user\ben_dchost\documents\中 我还假设它需要的参数是-flag1 -flag2 -flag3

I am assuming that your executible.exe is present in c:\user\ben_dchost\documents\ I am also assuming that the parameters it takes are -flag1 -flag2 -flag3

对于您说要执行的命令,请执行以下操作:

For the command you say you want to execute, do:

cd C:\Users\Ben\Desktop\BGInfo\
bginfo.exe dc_bginfo.bgi
pause

希望这会有所帮助

这篇关于创建一个批处理文件以运行带有附加参数的.exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆