How to Change a Process Priority in a Batch Script
The Windows Task Scheduler manages how the CPU allocates time to all the different programs that are running. By default, most processes run at a "Normal" priority. However, you can influence this scheduler by changing a process's priority. You might want to lower the priority of a long, non-critical task (like a background file compression) to keep your system responsive, or raise the priority of a critical process to ensure it gets as much CPU time as possible.
This guide will teach you how to set the priority of a process as you launch it using the START command. You will learn the different priority levels available and how to use this command to effectively manage system resources from a batch script.
The Core Command: START with Priority Switches
The easiest and most common way to control a process's priority from a batch script is to set it at the moment of launch. The versatile START command, which is used to open a new window or run a program, has built-in switches for this.
Syntax:START "Window Title" /<PriorityLevel> "path\to\program.exe"
"Window Title": TheSTARTcommand has a quirky syntax where the first quoted string is always treated as the window title. You must include it, even if it's just an empty pair of quotes ("")./<PriorityLevel>: The switch that sets the priority."path\to\program.exe": The application you want to launch.
Understanding Process Priority Levels
Windows offers six priority levels that you can set from the START command. These correspond to the levels you can see in the Task Manager.
START Switch | Priority Level | Description |
|---|---|---|
/LOW | Low | Gets CPU time only when other processes are idle. Best for long-running, non-interactive background tasks. |
/BELOWNORMAL | Below Normal | Gets less CPU time than normal processes. |
/NORMAL | Normal | The default for most applications. |
/ABOVENORMAL | Above Normal | Gets more CPU time than normal processes. |
/HIGH | High | Gets a very high share of CPU time. Use with caution, as it can make the system feel unresponsive. |
/REALTIME | Realtime | The highest priority. Do not use this. It can preempt critical system processes (like keyboard and mouse input) and can easily lock up your entire system. |
Basic Example: Launching a Low-Priority Task
This is the most common and safest use case. This script starts a backup process at a low priority so that it doesn't interfere with the user's interactive work.
@ECHO OFF
ECHO --- Starting Background Backup ---
ECHO.
ECHO The backup will run in a new window at low priority.
ECHO You can continue to use your computer normally.
ECHO.
REM --- The START command with the /LOW switch ---
START "My Backup Process" /LOW robocopy "C:\Users\Admin\Documents" "E:\Backups" /MIR
When you run this, a new command prompt window will appear with the title "My Backup Process," and the robocopy command will execute within it at a low CPU priority.
Changing the Priority of an Already Running Process
What if you need to change the priority of a process that is already running? The START command cannot do this. For this task, you must use the wmic process command.
Syntax: wmic process where name="process.exe" call setpriority <PriorityLevel>
The priority level can be a name (e.g., "High Priority") or a number.
This script finds notepad.exe and changes its priority to "Above Normal". This requires administrator rights.
@ECHO OFF
REM Run as Administrator.
SET "ProcessName=notepad.exe"
SET "NewPriority=Above Normal"
ECHO Changing priority for %ProcessName% to "%NewPriority%"...
wmic process where name="%ProcessName%" call setpriority "%NewPriority%"
Common Pitfalls and How to Solve Them
-
Forgetting the "Title" in
START: This is the most common syntax error. TheSTARTcommand's first quoted string is always the title. If you omit it and try to runSTART /LOW "C:\My App\run.exe", it will open a new command prompt with the title/LOWand will not run your program.- Solution: Always include a title, even if it's just empty quotes:
START "" /LOW ...
- Solution: Always include a title, even if it's just empty quotes:
-
Administrator Rights:
START /HIGH: Setting a priority to "High" or "Realtime" often requires administrator privileges.wmic process setpriority: Changing the priority of an already-running process almost always requires you to be an Administrator.- Solution: Run your script from an elevated command prompt.
-
Using
/REALTIME: It is worth repeating: do not use/REALTIME. This priority is higher than keyboard, mouse, and disk buffer processes. A CPU-intensive process running at this level can make it impossible to regain control of your computer without a hard reboot.
Practical Example: A High-Priority Calculation Script
This script needs to run a CPU-intensive calculation (calculator.exe) and wants to ensure it finishes as quickly as possible by giving it a higher priority.
@ECHO OFF
SETLOCAL
SET "CalculatorApp=C:\MyPrograms\HeavyCalculator.exe"
SET "InputData=C:\Data\input.dat"
ECHO --- High-Priority Calculation ---
ECHO This script will run the calculation at 'Above Normal' priority
ECHO to ensure it gets preferential CPU access.
ECHO.
IF NOT EXIST "%CalculatorApp%" (
ECHO [ERROR] Calculator application not found.
GOTO :End
)
ECHO Starting calculator...
REM Start the process with an elevated priority.
START "Calculation" /ABOVENORMAL "%CalculatorApp%" --input "%InputData%"
ECHO.
ECHO The calculation has been started in a new window.
:End
ENDLOCAL
Conclusion
Controlling process priority is a key tool for managing system resources and performance.
- The
STARTcommand is the simplest and most effective way to set the priority of a process as it is launched. - Use
/LOWfor long-running background tasks to keep the system responsive. - Use
/ABOVENORMALor/HIGHwith caution for critical tasks that need to complete quickly. - Never use
/REALTIME. - To change the priority of an already-running process, you must use the more advanced
wmic process ... call setprioritycommand, which requires administrator rights.
By using START's priority switches, you can write smarter scripts that work in harmony with the user and the operating system.