TruMan1
TruMan1

Reputation: 36068

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

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.

Upvotes: 15

Views: 35540

Answers (4)

npocmaka
npocmaka

Reputation: 57252

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.

Upvotes: 0

Samuel Neff
Samuel Neff

Reputation: 74899

Use

START c:\wherever\whatever.exe

Upvotes: 15

Gabe
Gabe

Reputation: 86698

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.

Upvotes: 16

Michael Sondergaard
Michael Sondergaard

Reputation: 1494

This will probably suffice.

call "cmd /c start notepad.exe"

Upvotes: 15

Related Questions