我想在Windows CMD控制台中运行两个命令。
在Linux中我会这样做
touch thisfile ; ls -lstrh
在Windows上是怎么做的呢?
我想在Windows CMD控制台中运行两个命令。
在Linux中我会这样做
touch thisfile ; ls -lstrh
在Windows上是怎么做的呢?
当前回答
为了同时执行两个命令,必须在两个命令之间加上&(&)符号。像这样:
color 0a & start chrome.exe
干杯!
其他回答
为了同时执行两个命令,必须在两个命令之间加上&(&)符号。像这样:
color 0a & start chrome.exe
干杯!
在windows 10中,你也可以使用scriprunner:
ScriptRunner.exe -appvscript demoA.cmd arg1 arg2 -appvscriptrunnerparameters -wait -timeout=30 -rollbackonerror -appvscript demoB.ps1 arg3 arg4 -appvscriptrunnerparameters -wait -timeout=30 -rollbackonerror
它允许你在一行上启动几个命令,你可以连续运行它们,也可以不等待彼此,你可以设置超时和错误回滚。
cmd /c ipconfig /all & Output.txt
该命令执行命令并在一个命令中打开Output.txt文件
再举一个例子:例如,当我们使用gulp构建系统时,而不是
Gulp -默认>构建
Gulp构建-构建构建文件夹
Gulp watch -开始文件监视
Gulp dist- build dist-folder
我们可以用一行代码来实现:
cd c:\xampp\htdocs\project & gulp & gulp watch
在windows中,我使用了上述所有解决方案&,&&,但都不起作用 ';'符号终于为我工作了
npm install; npm start