How to Get a List of Startup Programs in a Batch Script
Startup programs are applications that are configured to run automatically when a user logs into Windows. While useful, an excessive number of startup items can significantly slow down the login process and consume system resources. As a system administrator or power user, you often need to audit these startup locations to diagnose performance issues or to ensure a clean system configuration.
This guide will teach you how to get a comprehensive list of startup programs using the powerful WMIC (Windows Management Instrumentation) command. You will learn the correct query to use and how to format the output into a clean, readable list.
The Challenge: Where Are Startup Programs Located?
Startup programs are not stored in a single, simple location. They can be launched from multiple places in the Windows Registry and file system, including:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run- The user's
Startupfolder (%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup) - The
All UsersStartupfolder (%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Startup)
Manually checking all these locations is tedious. WMIC provides a single, unified way to query all of them at once.
The Core Method: WMIC STARTUP
The WMIC (Windows Management Instrumentation Command-line) utility is the standard tool for querying all kinds of system information. To get the list of startup items, we use the STARTUP alias.
Command:WMIC STARTUP GET Caption,Command,User
STARTUP: The WMI "class" that represents programs that run at system startup.GET: The verb used to specify which properties you want to see.Caption,Command,User: The specific properties we are requesting for each startup item.
Basic Example: A Simple List of Startup Items
Running the basic WMIC command gives you a formatted table of all startup programs for the current user and for all users.
@ECHO OFF
ECHO --- Querying all startup programs ---
ECHO This may take a moment...
ECHO.
WMIC STARTUP GET Caption,Command,User
PAUSE
In the output, the command produces a clean, table-formatted list.
Caption Command User
OneDrive "C:\Program Files\Microsoft OneDrive\OneDrive.exe" ... MY-PC\AdminUser
My Custom App "C:\Program Files (x86)\CustomApp\launcher.exe" -silent All Users
WindowsTerminal wt.exe MY-PC\AdminUser
Customizing the Output with /FORMAT
While the default table is readable, you might want the data in a different format for parsing in a script or for creating a report. WMIC's /FORMAT switch is perfect for this.
Script: CSV Output
This command formats the output as a Comma-Separated Values (CSV) list, which is perfect for importing into a spreadsheet or another program.
@ECHO OFF
SET "OutputFile=startup_report.csv"
ECHO Generating startup report as a CSV file...
REM The /FORMAT:CSV switch changes the output style.
WMIC STARTUP GET Caption,Command,User /FORMAT:CSV > "%OutputFile%"
ECHO.
ECHO Report created: %OutputFile%
Key WMIC STARTUP Properties Explained
The STARTUP class has several useful properties you can GET. The most important ones are:
Caption: The common name of the startup entry (e.g., "Microsoft OneDrive").Command: The full command line that is executed, including the path and any arguments.User: The user for whom the item runs. This can be a specific user or "All Users".Location: The location where the startup entry is defined (e.g.,HKLM\SOFTWARE\...\RunorStartup).
Common Pitfalls and How to Solve Them
-
Permissions: While
WMIC STARTUPcan often be run as a standard user, it provides the most complete and accurate information when run as an Administrator. An administrator can see the startup items for all users on the system, not just the current one. -
Disabled Startup Items: The
WMIC STARTUPquery only shows enabled startup items. It does not list items that have been disabled via the Task Manager. This is a limitation of the underlying WMI class. For a more comprehensive audit that includes disabled items, you would need to query the registry keys directly. -
Slow Execution: The first time you run a
WMICcommand in a script, there can be a noticeable delay as it initializes its repository. This is normal behavior.
Practical Example: A Startup Audit Script
This script generates a detailed report of all startup items and saves it to a text file. It requests a more comprehensive list of properties and formats the output for readability.
@ECHO OFF
SETLOCAL
SET "ReportFile=%USERPROFILE%\Desktop\Startup_Audit.txt"
ECHO --- Startup Application Audit ---
ECHO Generating a detailed report. This may take a few seconds...
ECHO.
REM --- Use a code block to redirect all ECHO output to the report file ---
(
ECHO Startup Audit Report
ECHO Generated on: %DATE% %TIME%
ECHO Computer: %COMPUTERNAME%
ECHO ================================================================
ECHO.
REM --- The WMIC command with a list format for readability ---
WMIC STARTUP GET Caption,Command,Location,User /FORMAT:LIST
) > "%ReportFile%"
ECHO [SUCCESS] Report has been saved to your desktop:
ECHO "%ReportFile%"
ECHO.
PAUSE
ENDLOCAL
The /FORMAT:LIST option produces a clean, easy-to-read, key-value report for each startup item.
Conclusion
The WMIC STARTUP command is the most powerful and reliable built-in tool for listing startup programs from a batch script. It consolidates information from multiple registry and file system locations into a single, easy-to-query source.
- The core command is
WMIC STARTUP GET Caption,Command,User. - You can use the
/FORMATswitch to get the output in different styles, like CSV or LIST. - For the most complete results, run your script as an Administrator.
- Be aware that this method only lists enabled startup items.
By using WMIC, you can easily automate the process of auditing and monitoring the applications that run when a user logs into Windows.