views:

690

answers:

1

I made this batch file to close explorer before launching Worms because for some reason my colors get messed up if I don't. The batch file works fine except that it doesn't close when it's finished. What did I do wrong?

@echo off
echo Closing explorer and launching worms
taskkill /F /IM explorer.exe
"C:\Games\Worms Armageddon - New Edition\wa"
echo Hit any key to resume explorer!
pause
"C:\windows\explorer"
exit

I've tried using start to call the programs and when I use

start "C:\windows\explorer"

it just opens a new command window and the titlebar says explorer.exe but my taskbar and everything is still gone.

+1  A: 

START is finicky. As per the help:

C:\>start /?
Starts a separate window to run a specified program or command.

START ["title"] [/Dpath] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
      [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]
      [/WAIT] [/B] [command/program]
      [parameters]

    "title"     Title to display in  window title bar.
    ...

As you can see here, the first argument could be a title. It seems that the quotes have a meaning here that could be a title, but not always.

Anyway, instead, try this:

start "dummy" "explorer.exe"

Note, you can avoid this by specifying the full path to explorer.exe, like this:

start c:\windows\explorer.exe

(note the missing quotes, put the quotes back, and it's a title again).

As I said, finicky.

Lasse V. Karlsen
Thank you Lasse, I don't even know why I put put those quotes there as there were no spaces in the path. It works now. :)
Remember to accept (and upvote if you please) answers that you consider "the one that gave me the solution" :)
Lasse V. Karlsen