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

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

  4. #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 .. problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Failover Guest Cluster -- 'The process cannot access the file becauseit is being used by another process.' J Wolfgang Goerlich Virtual Server 0 06 Feb 2009
Process count wrong when only one process matches criteria malverson26 PowerShell 3 06 Oct 2007
IEUser restart through Restart Manager works but... jgomezb@gmail.com Vista General 0 14 Mar 2007
get-process & stop-process by owner Andrew Conrad PowerShell 3 03 Mar 2007
Bug? Shouldn't Stop-Process automatically match Id if object is a process? Alex K. Angelopoulos [MVP] PowerShell 3 21 Jun 2006