Change process priority for all running instances

Description

The following script sets all processes with a matching filename to different priorities.

Im my case I am using this to change the priority of my Minecraft server between high and belownormal depending on whether I’m just running the server or managing it. I had to set the same CPU priority for all running instances of the same processes quick and easy.

Parameters

Change blue to the software you are using and red to the priority to wish to use. Paste code into notepad (or a better replacement such as Notepad++) and save as a *.bat file. Add to schedule or as a shortcut.

You can for example replace java.exe to explorer.exe if you wish to prioritize moving/copying files.

Batch Code

set pid=
FOR /F "tokens=2" %%i IN ('tasklist ^| Find /i "java.exe"') DO CALL process -p %%i high
goto :EOF

Requirements

Craig Peacocks process.exe command-line tool. Download directly or from his site!
(Thank you for the permission to mirror Craig!)
Place this in the same folder as the batch script or in your windows folder for global use.

Tags: Set process priority for multiple processes. Batch windows xp vista 7 change process priority shortcut. Quickly change process priority for all instances of a running process. Set cpu process priority shortcut.

Advertisements

2 Comments on “Change process priority for all running instances”

  1. Jim says:

    If you want to change ALL your process to Low. Run this batch as Administrator:

    set pid=
    FOR /F “tokens=2” %%i IN (‘tasklist ^| Find /i “.exe”‘) DO CALL wmic process where ProcessId=%%i CALL setpriority 64
    goto :EOF

    Somehow “CALL process” doesn’t work for me.

    • Jim says:

      Where it is 64 after setpriority you can change your desire priority following this list:
      Idle: 64
      Below Normal: 16384
      Normal: 32
      Above Normal: 32768
      High Priority: 128
      Real Time: 256


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s