CMD提示:使用参数启动2个程序时程序关闭

时间:2016-06-17 16:31:10

标签: powershell batch-file cmd

我正在尝试在批处理文件中同时运行一个PowerShell命令和一个名为Psuite的程序。

我搜索了S.O.我发现了一个有趣的命令:调用:RunProgramAsync,但是我研究了它并且根本不能使它工作。

以下是我想要执行的命令。目前,它将运行第一个,关闭它。我想让它在保持第一个的同时运行第一个然后第二个。每个命令都可以自行运行。

以下是我想要运行的内容:

cd C:\ASD\scripts
start PowerShell.exe -NoProfile -Command "& {Start-Process PowerShell.exe -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File ""%~dpn0.ps1""' -Verb RunAs}"


cd C:\psuitent\tests
start psuite -l200 -EGB5 $c:\psuitent\swt\hpsmtsas.swt

有人能帮助我吗?我一直在搜索,无法找到解决方案。

1 个答案:

答案 0 :(得分:0)

当您使用start时,它会打开一个新窗口,因此这可能会导致cd出现问题,请尝试使用以下内容:

start "" /d "C:\ASD\scripts" PowerShell.exe -NoProfile -Command "& {Start-Process PowerShell.exe -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File ""%~dpn0.ps1""' -Verb RunAs}"
start "" /d "C:\psuitent\tests" psuite -l200 -EGB5 $c:\psuitent\swt\hpsmtsas.swt

希望这有帮助!

来源:Running multiple commands simultaneously