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

Author Topic: Batch file 'START' command issue  (Read 2772 times)

0 Members and 1 Guest are viewing this topic.

GeoffGeoff

  • Guest
Batch file 'START' command issue
« on: May 23, 2011, 10:01:17 PM »
Hi Everybody!  This is my first post, and I'm not especially experienced with batch files, but here's my problem:

I was trying to write a program that:
1. Checks to see if *****.exe is running
2. If it is running, notifies me
3. If it is not running, notifies me AND starts the program

After spending an hour before realizing that the command 'TASKLIST /FI' has no errorlevel...I finally got it to run the logic perfectly so the program notifies me accordingly, BUT when the start command is run it starts a new command prompt window with the file's address as its name!

Here is a copy of the script so far with asterisks in place of unnecessary information:

@echo off
tasklist | find /i "*****"
if not errorlevel 1 echo "*****************************"
if errorlevel 1 echo "*****************************" & start "C:\Program Files (x86)\*****\*****.exe"

Fairly simple methinks, but I can't figure out why it won't start the actual program, and instead creates a new command prompt instance with the name being the exact address (C:\Program Files (x86)\*****\*****.exe) including the .exe part.

I hope it's an easily fixed problem, and thanks for your help!