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.
Asked
Active
Viewed 3.1k times
15
-
Possible duplicate of [How can I run a program from a batch file without leaving the console open after the program starts?](https://stackoverflow.com/questions/324539/how-can-i-run-a-program-from-a-batch-file-without-leaving-the-console-open-after) – underscore_d Nov 15 '19 at 12:58
4 Answers
16
Why not just start somecmd.exe
or start "" "some command with spaces.exe"
?
Note that if your command has spaces, you must put quotes around it, but if the first argument to start
has quote around it the command is the second argument, so I have two sets of quotes there.

Gabe
- 84,912
- 12
- 139
- 238
-
2To answer your question as to "why not"? Well, because it's completely non-intuitive that dos would somehow assume that putting your command in quotes would magically make it the second argument. In fact, even given your explanation it's not clear why the second example works, but it does, and I thank you for posting this. – jgritty Aug 27 '12 at 21:24
-
1I just checked out start /? and it seems that if you put something in quotes, it assumes that is the "title" of the window, not that it magically becomes the second argument. Although, on my first few readings of that doc, it wasn't clear how to actually do what your examples does. – jgritty Aug 27 '12 at 21:26
15
Use
START c:\wherever\whatever.exe

Samuel Neff
- 73,278
- 17
- 138
- 182
-
Supply a title via `START "My Title" C:\wherever\whatever.exe` (can also specify title as blank string `""`). It is good to specify a title because while "the title is optional, [...] depending on the other options chosen you can have problems if it is omitted"(https://ss64.com/nt/start.html). – Babak Apr 30 '19 at 17:53
-
In case you want to stop the task later, use `tskill whatever`, where "whatever" is the program name. Usually it's the filename without ".exe". If not, search for the name in the returned list of `tasklist`. – Linus Caldwell Jan 22 '21 at 17:07
0
SCRIPTRUNNER
scriptrunner -appvscript notepad
the command has some nice features as timeout,wait and so on.
SCHTASKS
SCHTASKS /create /tn BatRunner /tr "%cd%\first.bat" /sc ONCE /sd 01/01/1910 /st 00:00
SCHTASKS /Run /TN BatRunner
SCHTASKS /Delete /TN BatRunner /F
This command main purpose is scheduling but you can use it to start another command without waiting
WMIC
WMIC process call create "notepad"
this will return the PID of the started process.

npocmaka
- 55,367
- 18
- 148
- 187