• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

restart a process in XP ..

M
#1
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 ...
 

My Computer

P

Pegasus \(MVP\)

#2
"Mark" <markbilk@xxxxxx> wrote in message
news:g4iqju$42p$1@xxxxxx

> 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
 

My Computer

M
#3
> 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 ..
 

My Computer

P

Pegasus \(MVP\)

#4
"Mark" <markbilk@xxxxxx> wrote in message
news:g4iskm$75f$1@xxxxxx

>> 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.
 

My Computer

Users Who Are Viewing This Thread (Users: 1, Guests: 0)