How to Run a GUI Program Minimized in Batch Script
When you launch a graphical (GUI) application from a batch script, it typically opens in a normal, focused window, which can interrupt the user's workflow. For background tasks, startup applications, or utilities that don't require immediate user interaction, it's far better to launch them minimized to the taskbar.
This guide will teach you how to use the powerful, built-in START command with its /MIN switch to launch any program in a minimized state. You will also learn the critical and often misunderstood "title" parameter syntax, which is essential for making the command work reliably with file paths.
The Core Command: START
The START command is a versatile utility designed to open a new command prompt window or run a program in a new process, separate from the batch script that's currently running. Because it creates a new window process, it has the ability to control that window's initial state (such as minimized or maximized).
The Key Parameter for Minimizing: /MIN
The /MIN switch is the specific option that tells the START command to run the new program in a minimized window.
Syntax: START /MIN <program>
/MIN: The switch to MINimize the window.<program>: The executable or file you want to launch.
Its natural counterpart is /MAX for launching a program MAXimized.
Basic Example: Launching Notepad Minimized
This is the simplest use of the command.
@ECHO OFF
ECHO --- Launching Notepad Minimized ---
ECHO.
ECHO A new Notepad process will start, but its window will be minimized.
ECHO Look for its icon in your taskbar.
START /MIN notepad.exe
When you run this, you won't see a Notepad window pop up. Instead, a new Notepad icon will appear on your taskbar, indicating that the program is running but its window is not active.
CRITICAL: The START Command's Quirky "Title" Parameter
This is the single most common point of failure when using the START command. The START command's syntax has an optional first parameter for a window "title".
START ["title"] [options] "command"
If the first argument after START is a quoted string, START will treat it as the title for the new window, not as the command to be executed. This creates a huge problem when your program path has spaces and needs to be quoted.
Example of error message:
REM This will FAIL. It will open a new CMD window titled "C:\Program Files..."
START /MIN "C:\Program Files\MyCoolApp\app.exe"
Solution: Provide an Empty Title
The standard and correct way to handle this is to provide a "dummy" title as the first parameter. An empty quoted string ("") is the universal convention for this.
REM This is the CORRECT, robust syntax.
START "" /MIN "C:\Program Files\MyCoolApp\app.exe"
Here, "" is treated as the title, and "C:\Program Files\..." is correctly interpreted as the command to run. You should make a habit of always using this START "" ... pattern.
Common Pitfalls and How to Solve Them
Problem: Starting a Program with a Path in Quotes
This is the "title" issue described above. Users naturally quote a path with spaces, but it fails when it's the first argument.
Solution: Always use the START "" "path\to\program" syntax. The empty "" acts as a placeholder title and ensures that your quoted path is treated as the command.
Problem: The Script Doesn't Wait for the Program to Close
By default, START launches a new program and then your batch script immediately continues to the next line without waiting. Sometimes, you need the script to pause until the launched program has been closed.
Solution: Use the /WAIT switch. This makes START a "blocking" command.
@ECHO OFF
ECHO --- Running a Silent Installer ---
ECHO This script will now run the installer minimized and wait for it to finish.
REM Use /WAIT to make the script pause here.
START "" /WAIT /MIN "C:\Installers\setup.exe" /silent
ECHO.
ECHO The installer has finished. The script can now continue.
This is extremely useful for running silent installers or other processes that need to complete before your script proceeds.
Practical Example: A Login Script to Start Background Apps
This script is designed to run when a user logs in. It starts several common applications (like a chat client and a file sync utility) minimized, so they are running in the background without cluttering the user's screen on startup.
@ECHO OFF
SETLOCAL
TITLE User Login Script
ECHO --- Starting background applications ---
ECHO.
ECHO Starting Communications App...
IF EXIST "C:\Program Files\MyChatApp\chatter.exe" (
START "Chat App" /MIN "C:\Program Files\MyChatApp\chatter.exe"
)
ECHO Starting File Sync Client...
IF EXIST "C:\Program Files\FileSync\sync.exe" (
START "" /MIN "C:\Program Files\FileSync\sync.exe" --background
)
ECHO.
ECHO --- Login script complete ---
ENDLOCAL
This example uses both a real title ("Chat App") and a dummy title ("") to show both are valid.
Conclusion
The START command is the definitive tool for launching applications with control over their window state.
Key takeaways for using it effectively:
- Use the
/MINswitch to launch a program in a minimized window. - CRITICAL: Always use the
START "" "path\to\program"syntax to correctly handle paths that contain spaces and require quotes. The empty""serves as a placeholder title. - Use the
/WAITswitch if you need your script to pause until the launched application is closed.