Computing.Net > Forums > Programming > Batch-- do not start if running

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch-- do not start if running

Reply to Message Icon

Name: Mitran
Date: October 13, 2006 at 19:39:42 Pacific
OS: XP Home
CPU/Ram: 2GH/256
Product: Dell
Comment:

Hi,

I have a batch script (below) that I put in the task scheduler to make sure FrostWire file sharing starts again when my Mom turns it off.

I need to know how to tell it to look and see if FrostWire is already running, and if it is, then don't try to run it again. Something like:

if %frostwire%==yes goto exit

(I found that here: http://aroundcny.com/Technofile/tex... )

What should I do?

Thanks much,

Martin

Here's the script so far:

min
"C:\Program Files\FrostWire\frostwire.exe"
sleep 10
window.exe /MIN "FrostWire: Enabling Open Information Sharing"



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: October 14, 2006 at 05:03:23 Pacific
Reply:

Hi Martin,

I don't mean to rain on your parade, but nothing in that batch looks familiar.

But it's worse than that. The WINSET used on that page is [AFAIK] a DOS app and probably won't effect the "global environment". Some things which try to mess with NT will generate a error like "blabla has attempted..." others will simply be ignored.



=====================================
If at first you don't succeed, you're about average.

M2



0

Response Number 2
Name: tonysathre
Date: October 14, 2006 at 09:32:21 Pacific
Reply:

You can do it with a third-party command line process explorer. Then your script would run the command with whatever switch is needed to print the current running processes. Then pipe that through findstr "frostwire.exe".

Here's a sample script:

@echo off
process | findstr "frostwire.exe"
if errorlevel 1 (
goto start) else (
goto :eof
)

:start
start %programfiles%\frostwire\frostwire.exe

I think you'll get the idea.

"Computer security." — Oxymoron


0

Response Number 3
Name: Mitran
Date: October 14, 2006 at 20:26:11 Pacific
Reply:

How cool, tonysathre,

I have a working script that does exactly what I want. I had to go download process.exe.

Thanks for your help (:

Here's the script for anyone else:

::MINIMIZE THE COMMAND WINDOW...
MIN
::FOR THE findstr, LETTER CASE SEEMS TO BE IMPORTANT. JAVAW.exe IS FROSTWIRE
process.exe | findstr /C:JAVAW.EXE
if errorlevel 1 (
goto start) else (
goto eof
)
endif
::NOT SURE IF endif MEANS ANYTHING
:start
::THESE MAKE SURE FROSTWIRE MINIMIZES AFTER STARTING, AS FAST AS POSSIBLE, NO MATTER HOW LONG IT HAPPENS TO TAKE TO START
"C:\Program Files\FrostWire\frostwire.exe"
sleep 3
window.exe /MIN "FrostWire: Enabling Open Information Sharing"
sleep 5
window.exe /MIN "FrostWire: Enabling Open Information Sharing"
sleep 8
window.exe /MIN "FrostWire: Enabling Open Information Sharing"
sleep 10
window.exe /MIN "FrostWire: Enabling Open Information Sharing"

:eof


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Batch-- do not start if running

Batch File and Start->Run... www.computing.net/answers/programming/batch-file-and-startrun/8973.html

Stored Procedure not working if OLE www.computing.net/answers/programming/stored-procedure-not-working-if-ole/10101.html

Batch file processing in Win2003 www.computing.net/answers/programming/batch-file-processing-in-win2003/12109.html