views:

419

answers:

2

Hi,

how do i run a .exe as low priority? i know i can go to task manager and change the priority setting there manually, but is there a way that i can launch the .exe from a .bat file with a command to make the .exe run at a given priority (in this case low)? the .exe is a program that i've written in c++, can i set the priority in c++ code? (maybe these are two separate questions.)

please let me know if you need more information. (i have no idea what information i should provide!) i am running windows xp.

thanks!

+7  A: 

In a batch file, you can use the start command:

Starts a separate window to run a specified program or command.

START ["title"] [/D path] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
      [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]
      [/AFFINITY <hex affinity>] [/WAIT] [/B] [command/program]
      [parameters]

[ . . . ]

    LOW         Start application in the IDLE priority class
    NORMAL      Start application in the NORMAL priority class
    HIGH        Start application in the HIGH priority class
    REALTIME    Start application in the REALTIME priority class
    ABOVENORMAL Start application in the ABOVENORMAL priority class
    BELOWNORMAL Start application in the BELOWNORMAL priority class
bobbymcr
thank you very much!
B Rivera
+3  A: 

To voluntarily drop your process priority, use SetPriorityClass. Also see the full discussion of process and thread priorities.

Martin v. Löwis