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

后端 未结 3 2034
借酒劲吻你
借酒劲吻你 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: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.

提交回复
热议问题