Changing Windows process priority on the fly via command line.

Message boards : Number crunching : Changing Windows process priority on the fly via command line.

To post messages, you must log in.

AuthorMessage
Profile HAL9000
Volunteer tester
Avatar

Send message
Joined: 11 Sep 99
Posts: 6111
Credit: 155,364,545
RAC: 50,228
United States
Message 1283633 - Posted: 14 Sep 2012, 15:26:09 UTC

It has been asked several times if there is a way in Windows to adjust process priority on the fly automatically. Generally you can install software such as process lasso or such.

However there is a command line option to so the same thing using wmic. Apparently it has been around since XP... I recently learned about it when doing some other things. So I figured I would share the info.

The command line syntax:
wmic process where name="AppName" CALL setpriority ProcessIDLevel

The customary notepad example setting it to "Above Normal":
wmic process where name="notepad.exe" CALL setpriority 32768

Idle:		64
Below Normal:	16384 
Normal:		32 
Above Normal:	32768
High Priority:	128
Real Time:	256


On XP/2003 I had to run wmic by itself first where it stated "Please wait while WMIC is installed.

At the moment I'm trying to work out how to use the Task Scheduler to set the science app priority up when the machine is idle and then return them to low when not idle.
SETI@home classic workunits: 93,865 CPU time: 863,447 hours
Join the BP6/VP6 User Group today!
ID: 1283633 · Report as offensive
.clair.

Send message
Joined: 4 Nov 04
Posts: 1300
Credit: 39,940,131
RAC: 28,768
United Kingdom
Message 1283730 - Posted: 14 Sep 2012, 19:46:38 UTC

Ah.
The hidden feature`s of an operating system . . .
If only we knew what they were,
where they iz
And wot to do with them once we have found them :¬)
For better or worse ....
ID: 1283730 · Report as offensive
Cruncher-American

Send message
Joined: 25 Mar 02
Posts: 1316
Credit: 176,363,908
RAC: 111,922
United States
Message 1283738 - Posted: 14 Sep 2012, 20:09:30 UTC - in response to Message 1283730.  

Yeah - almost as well documented as my phone apps. God, bad programmers ought to have their own personal place in Hell.
ID: 1283738 · Report as offensive
outlaw

Send message
Joined: 6 Mar 00
Posts: 43
Credit: 17,063,897
RAC: 0
Canada
Message 1286355 - Posted: 21 Sep 2012, 17:37:05 UTC

You can use Task Manager, it is probably quicker and less error prone; and they both call the same API.

Go to the Processes tab, right click the process you wish to change the priority of...
ID: 1286355 · Report as offensive
EdwardPF
Volunteer tester

Send message
Joined: 26 Jul 99
Posts: 292
Credit: 100,216,060
RAC: 66,229
United States
Message 1286518 - Posted: 22 Sep 2012, 3:38:56 UTC - in response to Message 1283633.  

I love this kind of stuff!!!!

Thanks for the post!!!

Ed F
ID: 1286518 · Report as offensive
kittymanProject Donor
Volunteer tester
Avatar

Send message
Joined: 9 Jul 00
Posts: 45964
Credit: 815,514,556
RAC: 123,454
United States
Message 1286548 - Posted: 22 Sep 2012, 6:46:23 UTC
Last modified: 22 Sep 2012, 6:46:41 UTC

Our friend Fred's priority tool does a wonderful job of setting the priority of Seti apps to whatever level you wish. And does so automatically every time a task is finished and a new task launches.
Always remember.....kitties are all Angels with fur.

Have made friends in this life.
Most were cats.
ID: 1286548 · Report as offensive
Profile HAL9000
Volunteer tester
Avatar

Send message
Joined: 11 Sep 99
Posts: 6111
Credit: 155,364,545
RAC: 50,228
United States
Message 1287391 - Posted: 24 Sep 2012, 14:16:01 UTC - in response to Message 1286355.  

You can use Task Manager, it is probably quicker and less error prone; and they both call the same API.

Go to the Processes tab, right click the process you wish to change the priority of...

This information is more for those that ask how to change the to process priority automatically. Other than telling them to "install 3rd party software".

Since I stumbled on it while doing other things & no one had mentioned it before, that I could find, I figured someone might have a use for it.

A full write up about all the various ways of controlling the science app processes would probably be more informative when I get around to putting this up on my webserver.

SETI@home classic workunits: 93,865 CPU time: 863,447 hours
Join the BP6/VP6 User Group today!
ID: 1287391 · Report as offensive

Message boards : Number crunching : Changing Windows process priority on the fly via command line.


 
©2016 University of California
 
SETI@home and Astropulse are funded by grants from the National Science Foundation, NASA, and donations from SETI@home volunteers. AstroPulse is funded in part by the NSF through grant AST-0307956.