Changing Windows process priority on the fly via command line.


log in

Advanced search

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

Author Message
Profile HAL9000
Volunteer tester
Avatar
Send message
Joined: 11 Sep 99
Posts: 3846
Credit: 106,547,202
RAC: 92,212
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!

clive G1FYE
Volunteer moderator
Send message
Joined: 4 Nov 04
Posts: 1300
Credit: 23,054,144
RAC: 0
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 ....

jravin
Send message
Joined: 25 Mar 02
Posts: 927
Credit: 94,607,273
RAC: 85,436
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.
____________

outlaw
Send message
Joined: 6 Mar 00
Posts: 43
Credit: 17,063,599
RAC: 105
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...
____________

EdwardPF
Volunteer tester
Send message
Joined: 26 Jul 99
Posts: 237
Credit: 47,982,724
RAC: 91,573
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

msattler
Volunteer tester
Avatar
Send message
Joined: 9 Jul 00
Posts: 38176
Credit: 556,835,016
RAC: 602,077
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.
____________
*********************************************
Embrace your inner kitty...ya know ya wanna!

I have met a few friends in my life.
Most were cats.

Profile HAL9000
Volunteer tester
Avatar
Send message
Joined: 11 Sep 99
Posts: 3846
Credit: 106,547,202
RAC: 92,212
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!

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

Copyright © 2014 University of California