Re: lower down the priority of the process automatically

From: Gerry Thomas (gfthomas_at_sympatico.ca)
Date: 04/15/04


Date: Thu, 15 Apr 2004 17:42:20 -0400


"Jon" <jon_d_r@msn.com> wrote in message
news:9b0216bc.0404150644.1f09062c@posting.google.com...
> "Gerry Thomas" <gfthomas@sympatico.ca> wrote in message
news:<Gcofc.23254$vF3.1493942@news20.bellglobal.com>...
> > "Jon" <jon_d_r@msn.com> wrote in message
> > news:9b0216bc.0404141132.57a862e0@posting.google.com...
> > > chliu@tit.edu.tw (Chien-hui Liu) wrote in message
> > news:<5e084a37.0404140632.773d5e48@posting.google.com>...
> > > > Hi,
> > > >
> > > > I write a batch file, which includes several commands as follows:
> > > > a.exe<a1.inp
> > > > a.exe<a2.inp
> > > > ..
> > > > And this batch file needs to run for almost a month.
> > > > I have to press "Ctrl-Alt-Del" and lower down the priority of the
> > > > process every time, then I can do another works I have to do
currently
> > > > important. Or else, the computer goes very slow. I use MS-windows
> > > > 2000.
> > > > Is there any way to automatically lower down the processes ? Like
> > > >
> > > > <lower_down_process_command> a.exe<a1.inp
> > > > <lower_down_process_command> a.exe<a2.inp
> > > > ...
> > > >
> > > > Thank you very much
> > > >
> > > > C. H. Liu
> > >
> > > One way you can do this is to use Windows Management Instrumentation
> > > (WMI) scripting. Check out Microsoft's websites about WMI Scripting.
> > > Using this, you can do something like this to accomplish what you
want
> > > to invoke "YOURPROGRAM.exe":
> > >
> > > Const LOW = 64
> > > strComputer = "."
> > > Set objWMIService = GetObject("winmgmts:" _
> > > & "{impersonationLevel=impersonate}!\\" & strComputer &
> > > "\root\cimv2")
> > > Set objStartup = objWMIService.Get("Win32_ProcessStartup")
> > > Set objConfig = objStartup.SpawnInstance_
> > > objConfig.PriorityClass = LOW
> > > Set objProcess = GetObject("winmgmts:root\cimv2:Win32_Process")
> > > objProcess.Create "YOURPROGRAM.exe", Null, objConfig, intProcessID
> >
> > That's as clear as glass but recall that this is c.l.f., haunt of the
> > Windows-be-damned-Fortran-for-Xbox (sic Portability 'R Us) coterie in
> > emulation of the saved and worthwhile at www.landoverbaptist.org/.
Anyway,
> > assuming you're on good terms with the Johnny Fever - type in the glass
> > cage you can do each other a turn by installing the latest PrcView from
> > www.prcview.com, which allows you to set the job's priority to whatever
and
> > more.
> >
> > Skip's Windows-centric suggestion is smarter in the sense that if life
were
> > to be found on Mars, and were one to ask it to guess how to schedule a
job
> > on a generic processor, and if instead of excuses, derision, and
pedantry
> > it were to come up with START, RUN, LOAD, and the like, one would
conclude
> > that it possessed some redeeming value without costing a nickel.
>
> Skip's solution is the one I'd choose (except that I usually use the Task
Manager).
>
> I thought the Windows Scripting code would bring a chuckle or two.

It's amazing how once you've seen WMI script you see it, or rather you
think you see it, all over the place. Must check out the F2003 CD to see if
there's any of it lurking therein.

I had a word with my Johnny Fever guy (SysOP) earlier today who brought
this C# WMI app to my attention:
http://www.codeproject.com/csharp/wmi.asp?target=wmi
He tells me that WMI is favored in .NET over dealing directly with the API.
It looks interesting.

-- 
E&OE
Ciao,
Gerry T.
______
"God is not willing to do everything and thereby take away our free will
and that share of glory that rightfully belongs to us."  -- Machiavelli.


Relevant Pages

  • Re: WMI works on one server but not another
    ... Well, yes installing DID help, but after the fact. ... Once I opened up the port I got a second error which was in fact due ... With WMI there and port 135 open all is well. ... "Tim Munro" wrote in message ...
    (microsoft.public.win32.programmer.wmi)
  • Re: SP2 vs. Norton AntiVirus
    ... > thanks for the quick response, however I can download it using LiveUpdate ... > installing Norton WMI update". ... >>Norton WMI Update and once it is installed, ... Installing the Norton Windows Management Instrumentation Update: ...
    (microsoft.public.windowsxp.general)
  • Re: EIF - The preffered event sink in a distributed environment
    ... check that the WMI service is started. ... (Net start winmgmt) ... problems installing EIF - this is because the setup uses WMI at one point ...
    (microsoft.public.vsnet.enterprise.tools)
  • Re: MP Install Error
    ... to see if the WMI service is runnning? ... >>Installing new MP. ... >>namespace CCM ... >>The error code is 80070424 ...
    (microsoft.public.sms.setup)

Loading