Windows Vista Forums

restart a process in XP ..

  1. #1


    Mark Guest

    restart a process in XP ..

    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 System SpecsSystem Spec

  2.   


  3. #2


    Pegasus \(MVP\) Guest

    Re: restart a process in XP ..


    "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 System SpecsSystem Spec

  4. #3


    Mark Guest

    Re: restart a process in XP ..

    > 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 System SpecsSystem Spec

  5. #4


    Pegasus \(MVP\) Guest

    Re: restart a process in XP ..


    "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 System SpecsSystem Spec


restart a process in XP ..
Similar Threads
Thread Forum
Failover Guest Cluster -- 'The process cannot access the file becauseit is being used by another process.' Virtual Server
Process count wrong when only one process matches criteria PowerShell
IEUser restart through Restart Manager works but... Vista General
get-process & stop-process by owner PowerShell
Bug? Shouldn't Stop-Process automatically match Id if object is a process? PowerShell