How to run multiple commands in a batch file?

牧云@^-^@ 提交于 2020-03-18 11:50:51

问题


I am having the below commands in a batch file. While i try to run it using Execute action in Finalbuilder project, 1st command alone was run. So, i planned to have each commands in various batch files. Could anyone please help me to run all the commands in a single batch file run with the delay (if required)?

Commands:

   dnvm list
   dnvm install 1.0.0-beta8
   dnvm use 1.0.0-beta8 –p
   dnvm -Args alias default 1.0.0-beta8

Also i am getting the below error when run the last command through batch file using Execute action in FinalBuilder project.

Error: Invoke-Expression: Positional parameter cannot be found that accepts argument


回答1:


call dnvm list
call dnvm install 1.0.0-beta8
call dnvm use 1.0.0-beta8 –p
call dnvm -Args alias default 1.0.0-beta8

call will execute the target then return to the following line of the batch when it terminates.




回答2:


You can try appending "START /WAIT" in front of every line. Like this:

START "" /WAIT "dnvm list"
START "" /WAIT "dnvm install 1.0.0-beta8"
START "" /WAIT "dnvm use 1.0.0-beta8 –p"
START "" /WAIT "dnvm -Args alias default 1.0.0-beta8"


来源:https://stackoverflow.com/questions/34922908/how-to-run-multiple-commands-in-a-batch-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!