Jump to content

Batch file help please


Recommended Posts

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!

Link to comment
Share on other sites


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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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...