Running Applications on A Higher Priority

By | September 7, 2010

Did you notice when you run a certain application on a Higher Priority things are processed really quickly (this also depends on what application are you running) but take for example WinRar which is the one I tried, things get zipped and extracted faster than it is on normal priority.  But there are some applications that have slower performance than normal, I guess you have to test and see whether you would benefit in this solution.


Now if you are free to change the codes you can just do it like this in C#

System.Diagnostics.Process myProcess = System.Diagnostics.Process.GetCurrentProcess();
myProcess.PriorityClass = System.Diagnostics.ProcessPriorityClass.High;

or VB

Dim myProcess As System.Diagnostics.Process = System.Diagnostics.Process.GetCurrentProcess()
myProcess.PriorityClass = System.Diagnostics.ProcessPriorityClass.High

and all you have to do is to invoke this before you load for Form or anywhere you want to change the Process priority.

But what is you dont have that luxury to do it in the code? Or the codes are jsut batch files or vbscripts which does not have a rich objects and classes available for use like .Net. Yes you can still do it by going to the task manager and assigning a process that priority but you dont want to do it anytime. Theres another solution which is really easy and all you have to do is run the process with the /<priority> switch.  Where the priority can be anything in this list

  • realtime
  • high
  • normal
  • low
  • abovenormal (Windows 2000 only)
  • belownormal(Windows 2000 only)

Now to do that all you have to do is to use the start command and here is the syntax

start /{priority} {application},

ex.

start /high winword
start /low notepad
"C:YourDirectory" start /realtime YourApplication.exe

or even from run command

cmd /c start /low calc

So you can use your imagination now if you want to use this in your scripts


Leave a Reply