简体   繁体   English

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

[英]CMD Prompt: Program shutting down when starting 2 programs with arguments

I am trying to run a powershell command and a program called Psuite simultaneously in a batch file. 我试图在批处理文件中同时运行一个powershell命令和一个名为Psuite的程序。

I searched through SO and I found an interesting command: Call :RunProgramAsync, but I researched it and can't make it work at all. 我搜索了SO,我找到了一个有趣的命令:调用:RunProgramAsync,但我研究了它,并且根本无法使它工作。

Here are the commands I want to execute. 这是我想要执行的命令。 Currently, it will run the first for a second, shut it off. 目前,它将运行第一个,关闭它。 I want it to run the first then the second while keeping the first on. 我想让它在保持第一个的同时运行第一个然后第二个。 Each command works on its own. 每个命令都可以自行运行。

Here is what I want to run: 这是我想要运行的:

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

Can someone help me? 有人能帮我吗? I have been searching all over and can't find a solution. 我一直在搜索,找不到解决方案。

when you use start it opens up a new window, so this might be causing an issue with cd , try something like this instead: 当你使用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

Hope this helps! 希望这可以帮助!

Source: Running multiple commands simultaneously 来源: 同时运行多个命令

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM