Computer Hope

Microsoft => Microsoft Windows => Windows Vista and 7 => Topic started by: Zylstra on September 06, 2007, 05:47:36 PM

Title: CPU Priority
Post by: Zylstra on September 06, 2007, 05:47:36 PM
Hello

I am using Windows Vista, and there are two applications in particular that I want to change the CPU priority. Windows Backup, and Defragmenter, as far as I am concerned, run at the regular CPU priority levels.

I read, after Googling, that the only way to change a tasks priority is to manually set them or use a command line parementer with the Start command and a batch file with scheduling (not quite what I want). I also read that you can download programs that will monitor task activity, and will change the CPU priority for you.

Since I have a laptop, my hard drive RPM's aren't the greatest on earth, so, defragmenting slows it down, thus, why I dont currently use the automatic defragment, but I do use backups. How can I make it so that the backup task, and the defragmenter tasks load at a low CPU utilization? (Rather, what is the best way?)

Thanks,
Zylstra
Title: Re: CPU Priority
Post by: ghostdog74 on September 06, 2007, 06:12:35 PM
you can set task priority
Code: [Select]
Const NORMAL        = 32
Const IDLE          = 64
Const HIGH_PRIORITY = 128
Const REALTIME      = 256
Const BELOW_NORMAL  = 16384
Const ABOVE_NORMAL  = 32768
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colProcesses = objWMIService.ExecQuery("Select * from Win32_Process Where Name = 'Notepad.exe'")
For Each objProcess in colProcesses
    objProcess.SetPriority(NORMAL)
Next
you will need to find out the process name of windows backup and defragementer