|
From: Mark on 3 Jul 2008 11:18 Hi there, I'm not a programmer and would really appricate some help here. I need a VB script to get the PID of a running process from the name and then kill it and/or restart it. I read about taskkill, but that opens a DOS box and requires the name of the process, the PID of which changes. Don't ask me to study examples as when I learned BASIC we were still using single letter variable names .. :) $winkill "someProcess" .. kill it ... $winkill -r "someProcess" .. kill it and restart ...
From: Pegasus (MVP) on 3 Jul 2008 11:42 "Mark" <markbilk(a)mozilla.org> wrote in message news:g4iqju$42p$1(a)news.datemas.de... > Hi there, > > I'm not a programmer and would really appricate some help here. I need a > VB script to get the PID of a running process from the name and then kill > it and/or restart it. I read about taskkill, but that opens a DOS box and > requires the name of the process, the PID of which changes. > > Don't ask me to study examples as when I learned BASIC we were still using > single letter variable names .. :) > > $winkill "someProcess" .. kill it ... > > $winkill -r "someProcess" .. kill it and restart ... This is my lazy day so I'll give you a one-line batch file solution that would kill the task "Duc20". @echo off for /f "tokens=2" %%a in ('tasklist ^| find /i "duc20"') do taskkill /pid %%a
From: Mark on 3 Jul 2008 11:52 > This is my lazy day so I'll give you a one-line batch file solution that would kill the task "Duc20". > @echo off > for /f "tokens=2" %%a in ('tasklist ^| find /i "duc20"') do taskkill /pid %%a kool .. I've been reading up and I see some other references to PID, I'll try the cut and paste method ..
From: Pegasus (MVP) on 3 Jul 2008 12:09 "Mark" <markbilk(a)mozilla.org> wrote in message news:g4iskm$75f$1(a)news.datemas.de... >> This is my lazy day so I'll give you a one-line batch file solution that >> would kill the task "Duc20". > >> @echo off >> for /f "tokens=2" %%a in ('tasklist ^| find /i "duc20"') do taskkill /pid >> %%a > > kool .. > > I've been reading up and I see some other references to PID, I'll try the > cut and paste method .. You could, of course, kill the task by its name, then restart it: @echo off tasklist | find /i "duc20" && taskkill /im "duc20.exe" /f "c:\Program Files\Duc\Duc20.exe" The above code assumes that you're running Windows XP Professional.
|
Pages: 1 Prev: reading stderror stream Next: [ann] another way to call api's from script (the PB way) |