View Full Version : Set priority task at startup
Alberto
January 6th 04, 09:35 PM
Hi, I need to set a low priority to a task that is loaded when the system
start.
How can i do that ?
Thanks to all
--
Alberto
if you want to contact me remove NOSPAM. from email address
Wesley Vogel
January 7th 04, 11:25 PM
Alberto;
If it's a Service or running as a Service:
Ctrl + Alt + Delete
Processes tab
Right click the Process
Set Priority
--
Hope this helps. Let us know.
Wes
In ,
Alberto > hunted and pecked:
> Hi, I need to set a low priority to a task that is loaded when the system
> start.
> How can i do that ?
>
> Thanks to all
>
> --
> Alberto
>
> if you want to contact me remove NOSPAM. from email address
Crusty \(-: Old B@stard :-\)
January 7th 04, 11:26 PM
That's changing the priority, after the task is running. He wants the task
to initially "start" in a certain priority. I believe "that" depends upon
how the task/program is written. Could be wrong here though!
"Wesley Vogel" > wrote in message
news:q2pIb.10946$I07.20884@attbi_s53...
> Alberto;
> If it's a Service or running as a Service:
> Ctrl + Alt + Delete
> Processes tab
> Right click the Process
> Set Priority
>
> --
> Hope this helps. Let us know.
> Wes
>
> In ,
> Alberto > hunted and pecked:
> > Hi, I need to set a low priority to a task that is loaded when the
system
> > start.
> > How can i do that ?
> >
> > Thanks to all
> >
> > --
> > Alberto
> >
> > if you want to contact me remove NOSPAM. from email address
Wesley Vogel
January 7th 04, 11:29 PM
Crusty;
I believe that I'll enroll in an English as a second language class. Just as soon as
I graduate from my Pig Latin course. ;o)
Wes
In ,
Crusty (-: Old B@stard :-) > hunted and pecked:
> That's changing the priority, after the task is running. He wants the task
> to initially "start" in a certain priority. I believe "that" depends upon
> how the task/program is written. Could be wrong here though!
>
> "Wesley Vogel" > wrote in message
> news:q2pIb.10946$I07.20884@attbi_s53...
> > Alberto;
> > If it's a Service or running as a Service:
> > Ctrl + Alt + Delete
> > Processes tab
> > Right click the Process
> > Set Priority
> >
> > --
> > Hope this helps. Let us know.
> > Wes
> >
> > In ,
> > Alberto > hunted and pecked:
> > > Hi, I need to set a low priority to a task that is loaded when the system
> > > start.
> > > How can i do that ?
> > >
> > > Thanks to all
> > >
> > > --
> > > Alberto
> > >
> > > if you want to contact me remove NOSPAM. from email address
Mark Shroyer
January 7th 04, 11:30 PM
Alberto wrote:
> Hi, I need to set a low priority to a task that is loaded when the system
> start.
> How can i do that ?
>
> Thanks to all
>
Using the Windows Script Host is one way to go about it. I don't
actually know VBScript (more of a unix guy myself), so sorry for the
ugliness of this code that I somehow pieced together, using scraps from
TechNet without really understanding the APIs:
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''
' Create a process with a specified priority.
'
' Shamelessly ripped from various parts of
' Microsoft TechNet: http://www.microsoft.com/technet/
Const NORMAL = 32
Const LOW = 64
Const HIGH = 128
Const BELOW_NORMAL = 16384
Const ABOVE_NORMAL = 32768
Executable = "C:\Windows\notepad.exe"
Priority = BELOW_NORMAL
Set objWMIService = GetObject("winmgmts:{impersonationLevel=" & _
"impersonate}!\\.\root\cimv2")
Set objStartup = objWMIService.Get("Win32_ProcessStartup")
Set objConfig = objStartup.SpawnInstance_
objConfig.PriorityClass = Priority
Set objProcess = GetObject("winmgmts:root\cimv2:Win32_Process")
objProcess.Create Executable, Null, objConfig, intProcessID
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''
Copy that and paste it into a file with the extension "vbs", then modify
the definitions of the Priority and Executable variables to your liking.
I'd assume that VBS files are by default associated with the Windows
Script Host on all Windows XP installations (at least, they were on
mine), so you should be able to just run that VBS file in order to
launch your program.
Off to learn VBScript, now that I realize how useful it actually is :)
Mark
--
+-----------------------------------------+
| Mark Shroyer > |
+-----------------------------------------+
We all do no end of feeling, and we mistake it for thinking.
- Mark Twain
vBulletin® v3.6.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.