Create a batch file to run an .exe with an additional parameter

后端 未结 3 2035
借酒劲吻你
借酒劲吻你 2020-12-15 04:08

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          


        
相关标签:
3条回答
  • 2020-12-15 04:09

    Found another solution for the same. It will be more helpful.

    START C:\"Program Files (x86)"\Test\"Test Automation"\finger.exe ConfigFile="C:\Users\PCName\Desktop\Automation\Documents\Validation_ZoneWise_Default.finger.Config"

    finger.exe is a parent program that is calling config solution. Note: if your path folder name consists of spaces, then do not forget to add "".

    0 讨论(0)
  • 2020-12-15 04:15

    You can use

    start "" "%USERPROFILE%\Desktop\BGInfo\bginfo.exe" "%USERPROFILE%\Desktop\BGInfo\dc_bginfo.bgi"
    

    or

    start "" /D "%USERPROFILE%\Desktop\BGInfo" bginfo.exe dc_bginfo.bgi
    

    or

    "%USERPROFILE%\Desktop\BGInfo\bginfo.exe" "%USERPROFILE%\Desktop\BGInfo\dc_bginfo.bgi"
    

    or

    cd /D "%USERPROFILE%\Desktop\BGInfo"
    bginfo.exe dc_bginfo.bgi
    

    Help on commands start and cd is output by executing in a command prompt window help start or start /? and help cd or cd /?.

    But I do not understand why you need a batch file at all for starting the application with the additional parameter. Create a shortcut (*.lnk) on your desktop for this application. Then right click on the shortcut, left click on Properties and append after a space character "%USERPROFILE%\Desktop\BGInfo\dc_bginfo.bgi" as parameter.

    0 讨论(0)
  • 2020-12-15 04:19

    in batch file abc.bat

    cd c:\user\ben_dchost\documents\
    executible.exe -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

    Edited:

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

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

    Hope this helps

    0 讨论(0)
提交回复
热议问题