档案a.bat:-
start powershell "npm init"
code .当我双击上面的文件时,它打开一个powershell窗口,其中执行npm init命令,它还打开visual studio code,其中打开的是当前目录。cmd.exe在此之后退出。但对于以下bat文件:-
start /min powershell "gulp scss; gulp watch-scss;"
start /min powershell "gulp js; gulp watch-js;"
start /min powershell "http-server;"
code .当我双击它时,除了cmd.exe不退出并保持处于等待状态(因为它正在等待visual代码关闭)之外,一切都会发生。
当所有命令都已执行时,我如何使cmd.exe退出(如a.bat的情况)?
更新
如果省略最后一行cmd.exe,批处理文件将不会一直打开code .。以下批处理文件工作正常:
start /min powershell "gulp scss; gulp watch-scss;"
start /min powershell "gulp js; gulp watch-js;"
start /min powershell "http-server;"当我添加行code .时,问题就开始了
发布于 2016-07-06 21:37:55
试着做这些
start "" /min powershell "gulp scss; gulp watch-scss;"
start "" /min powershell "gulp js; gulp watch-js;"
start "" /min powershell "http-server;"
code .或者,如果您正在运行powershell文件,请使用以下命令
Powershell.exe -executionpolicy remotesigned -File location\to\ps\file.pshttps://stackoverflow.com/questions/38231249
复制相似问题