Jump to content

Recommended Posts

Posted

Does anyone know anything about batch files? I'm trying to make one that will close firefox and then open it again. I can get it to start firefox again, but I've been looking around for a way to close it, but I can't get any of it to work.

All help appreciated!

Thanks!


Posted (edited)

Try This

@Echo Off
CLS
start /w taskkill /F /IM PLACE_THE_NAME_OF_APP_HERE
:: Stops The Script For Approx 5 Seconds Then Restart The App
ping -n 5 127.0.0.1>nul
start PLACE_THE_NAME_OF_APP_HERE

Edited by gunsmokingman
Posted

Since everyone tends to have cmdow.exe, but rarely uses any of its features, I thought I'd produce an alternative method for you!

@CMDOW @ /HID &FOR /F %%? IN ('CMDOW /T /B ^|FIND /I "FIREFOX"') DO (IF ERRORLEVEL 0 (CMDOW %%? /END &&(PING -n 6 LOCALHOST &CMDOW /RUN FIREFOX)))

This code should all be pasted onto a single line of your batch file.

For those of you not already in posession of the cmdow utility, you can download it directly here and read more here.

Posted

Hmm... what is the taskkill thing? Is it an exe in system32 or something? I searched my computer for that and it wasn't there, maybe I'm missing it or something...

Posted (edited)

Taskkill was implemented in Windows XP. If you're running an older OS, download pskill in it's place. If you drop pskill into your %WINDIR% the code of line three would be:

pskill firefox

If you put pskill in the same directory as the batch file the syntax of line three would be:

.\pskill firefox

I've found pskill to be more powerful than taskkill at killing some apps.

Edited by quijibo

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...