How to Start a New Process in Batch Script
A fundamental task for any script is to launch other programs or executables. By default, when you run a program from a batch script, the script will pause and wait for that program to be closed before continuing. While this is sometimes useful, it's often not the desired behavior. You typically want your script to launch an application and then continue with its own tasks without waiting.
This guide will teach you how to use the standard, built-in START command to launch new processes. You will learn the critical difference between a "blocking" and "non-blocking" launch, and how to use START's parameters to control the new process's window and behavior.
The Default Behavior: Blocking Execution
When you put the name of an executable in a batch script, the script's execution is handed over to that program. The script itself freezes and will not proceed to the next line until the program is closed.
@ECHO OFF
ECHO Launching Notepad...
notepad.exe
ECHO Notepad has been closed. The script can now finish.
What happens:
- The script prints "Launching Notepad...".
- A Notepad window opens.
- The script stops and waits.
- Only after you manually close the Notepad window will the script resume and print "Notepad has been closed...".
This is called blocking or synchronous execution.
The Core Command: START for Non-Blocking Execution
The START command is designed to launch a program in a new, separate process. This allows your batch script to launch the program and immediately continue to its next line without waiting.
Syntax: START <program> [arguments]
For example:
@ECHO OFF
ECHO Launching Notepad in a new process...
START notepad.exe
ECHO The START command has finished, and the script continues immediately.
What happens:
- The script prints "Launching Notepad...".
- A Notepad window opens.
- The script immediately prints "The START command has finished...". It does not wait for you to close Notepad.
This is called non-blocking or asynchronous execution and is the main reason to use the START command.
Key START Parameters Explained
START has several useful switches to control the new process.
| Switch | Name | Description |
|---|---|---|
| /MIN | Minimize | Starts the new program in a minimized window. |
| /MAX | Maximize | Starts the new program in a maximized window. |
| /B | Bare | Starts the application without creating a new window. The new process shares the same command prompt window. (Useful for console apps). |
| /WAIT | Wait | This powerful switch reverses the default behavior. It makes START a blocking command, forcing the script to wait until the new process is closed. |
CRITICAL: The Quirky "Title" Parameter
This is the most common source of errors for anyone using the START command. The START syntax allows for an optional first parameter to be the "title" of the new window.
START ["title"] [options] "command"
If the very first argument you provide to START is a quoted string, START will always interpret it as the window title, not as the program you want to run.
Example of script with error:
REM This will FAIL. It opens a new CMD window with a very long title.
START "C:\Program Files\My Application\app.exe"
Solution: Provide a Dummy Title
The standard and correct way to handle this is to always provide a placeholder title (an empty quoted string "") as the first argument. This ensures your quoted path is treated as the command.
REM This is the CORRECT, robust syntax.
START "" "C:\Program Files\My Application\app.exe"
You should make a habit of always using this START "" ... pattern.
Common Pitfalls and How to Solve Them
Problem: Starting a Command Without a New Window
Sometimes you want to run a command-line tool as a new, separate process, but you don't want a new cmd.exe window to pop up.
Example of script with error:
REM This opens a new, temporary command window just to run the PING.
START ping google.com -t
Solution: Use the /B Switch
The /B switch runs the command in the background within the same window.
REM This runs the PING in the background of the current window.
START /B ping google.com -t
This is great for launching background tasks.
Practical Example: A "Launch Tools" Utility
This script acts as a simple dashboard to launch several common utilities at once. Because it uses START, all the programs open simultaneously.
@ECHO OFF
TITLE Tool Launcher
ECHO --- Launching Standard Utilities ---
ECHO.
ECHO Launching Notepad...
START "" "notepad.exe"
ECHO Launching Calculator...
START "" "calc.exe"
ECHO Launching Character Map...
START "" "charmap.exe"
ECHO.
ECHO --- All applications have been launched. ---
Conclusion
The START command is an essential tool for controlling how your batch script launches other programs and commands.
Key takeaways:
- By default, running a program is a blocking operation.
- Use
STARTto launch a program in a non-blocking way, allowing your script to continue immediately. - CRITICAL: Always use the
START "" "path\to\program"syntax to correctly handle paths that contain spaces. - Use
START /WAITwhen you need to launch a program but still need your script to pause until it's finished (e.g., for silent installers). - Use switches like
/MINand/MAXto control the appearance of the new window.