Question

  • Creator
    Topic
  • #2146404

    Script

    Locked

    by dp_kaplan ·

    I need help in writing a script to schedule the following on a Win XP Pro
    workstation:
    1. End a running application
    2. Start a second application
    3. When the second application ends start the first application again.

    Thanks,

    David

All Answers

  • Author
    Replies
    • #2461449

      Clarifications

      by dp_kaplan ·

      In reply to Script

      Clarifications

    • #2461364

      This will work for you

      by bizzo ·

      In reply to Script

      Firstly download PsTools from sysinternals and extract pskill.exe
      http://technet.microsoft.com/en-us/sysinternals/bb896683.aspx

      And here’s the batch file, you can replace the applications winword.exe and notepad.exe. It’s written so if the first application doesn’t exist, or if the first app cannot be stopped, it doesn’t start the second.
      So here it is:

      ———————————–

      @echo
      off
      pskill winword.exe

      if errorlevel 0 goto :kill1
      if errorlevel -1 goto :nokill
      goto :finish

      :nokill
      echo No initial process to kill
      goto finish

      :kill1
      start /wait notepad.exe
      start winword.exe

      :finish

      ———————————–

Viewing 1 reply thread