8

I'm using Windows 7, and have a simple batch file to copy portable executables off my thumb drive to %TEMP%, and then start them. The goal is to prevent Windows from holding my thumbdrive hostage until I kill all the programs I started up from it.

However the control flow does not continue to the next app unless I kill the first one, which obviously doesn't work for this purpose.

In a Unix shell script I'd simply add & after the executable I start up, but I can't find an equivalent for batch files.

How can I do this?

Synetech
  • 68,827
iconoclast
  • 3,320

1 Answers1

8

You can use the start command.

Like so: start someprogram.exe

It will start the program then give control back to the main batch file, running the second program in the background.

benj
  • 321
  • Excellent: thanks. I'm sure that was a painfully dumb question to anyone who regularly works with batch files. – iconoclast Aug 23 '12 at 22:33
  • 2
    If the path for the executable contains spaces, you need to use start "" "foo\my program.exe". Type start /? for details. – paradroid Aug 23 '12 at 22:33
  • 2
    Not dumb at all, it's a good question. You can also run batch files from other batch files using the call command. On StackOverflow.com there's a question with a list of cool tricks you can do on the Windows command line, it's great! – Mark Allen Aug 23 '12 at 23:42