Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: A "autorun batch file"  (Read 2603 times)

0 Members and 1 Guest are viewing this topic.

LeX.476

  • Guest
A "autorun batch file"
« on: October 29, 2006, 08:26:30 PM »
Hello everybody!
It feels like i've looked everywhere but i cant find any solution to my problem...
I want to make a batch file that, when you start it it starts a program and if this program is already running i want nothing to happen..
can anybody plz make my life a bit easyer by solving this problem of mine  :)?

Best Regards
LeX

GuruGary



    Adviser
    Re: A "autorun batch file"
    « Reply #1 on: October 29, 2006, 10:32:03 PM »
    What version of Windows are you running?

    You can try the TASKLIST command.  Something like:
    Code: [Select]
    tasklist /fi "imagename eq MYRPOG.exe"or
    Code: [Select]
    @echo off
    tasklist /fi "imagename eq MYPROG.exe"|findstr PID
    if not errorlevel 1 goto :Nothing
    echo Make something happen
    goto :EOF

    :Nothing

    LeX.476

    • Guest
    Re: A "autorun batch file"
    « Reply #2 on: October 30, 2006, 12:02:32 AM »
    Windoes XP Pro

    cant get it to work  :-?
    what to put in "imagename"?
    « Last Edit: October 30, 2006, 12:34:39 AM by LeX.476 »

    GuruGary



      Adviser
      Re: A "autorun batch file"
      « Reply #3 on: October 30, 2006, 04:11:06 PM »
      Quote
      ...I want to make a batch file that, when you start it it starts a program and if [highlight]this program[/highlight] is already running i want nothing to happen...
      What is "this program"?

      For this to work, you need to replace the MYPROG.exe in my code with the real file name of "this program".