windows 如何不等待批处理脚本中的进程完成?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2451861/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 14:07:22  来源:igfitidea点击:

How to NOT wait for a process to complete in batch script?

windowscommand-linebatch-file

提问by TruMan1

I have a batch script that calls a process and currently it waits for the process to complete before going to the next line. Is there a way (or a switch) for it NOT to wait and just spawn the process and continue? I am using Windows 2008.

我有一个调用进程的批处理脚本,目前它在进入下一行之前等待进程完成。有没有办法(或开关)让它不等待而只是产生进程并继续?我正在使用 Windows 2008。

采纳答案by Samuel Neff

Use

START c:\wherever\whatever.exe

回答by Gabe

Why not just start somecmd.exeor start "" "some command with spaces.exe"?

为什么不只是start somecmd.exestart "" "some command with spaces.exe"

Note that if your command has spaces, you must put quotes around it, but if the first argument to starthas quote around it the command is the secondargument, so I have two sets of quotes there.

请注意,如果你的命令有空格,你必须在它周围加上引号,但如果第一个参数start有引号,则命令是第二个参数,所以我在那里有两组引号。

回答by Michael Sondergaard

This will probably suffice.

这可能就足够了。

call "cmd /c start notepad.exe"