Developerium
Developerium

Reputation: 7265

startup batch file hangs up on second command

I created a startup bat file that looks like this

 taskkill /im RemoteDesktopManager.exe
 C:\Users\kheradmand\AppData\Local\Google\Chrome\Application\chrome.exe
 "C:\Program Files (x86)\JetBrains\PhpStorm 7.1.2\bin\PhpStorm.exe"
 "C:\Program Files\Mozilla Firefox\firefox.exe"

it does the first and second, but won't go any further, they all exist

how can I fix this?

update : I tried suggestion provided by @phd443322 and wrote this:

taskkill /im RemoteDesktopManager.exe
start "" /w C:\Users\kheradmand\AppData\Local\Google\Chrome\Application\chrome.exe
start "" /w "C:\Program Files (x86)\JetBrains\PhpStorm 7.1.2\bin\PhpStorm.exe"
start "" /w "C:\Program Files\Mozilla Firefox\firefox.exe"

intrestingly each command still waits for that program to be closed to continue to the next.

so why still not working?

Upvotes: 3

Views: 8084

Answers (2)

Aacini
Aacini

Reputation: 67216

Below there is a working Batch file, as first advised by phd443322:

taskkill /im RemoteDesktopManager.exe
start "" C:\Users\kheradmand\AppData\Local\Google\Chrome\Application\chrome.exe
start "" "C:\Program Files (x86)\JetBrains\PhpStorm 7.1.2\bin\PhpStorm.exe"
start "" "C:\Program Files\Mozilla Firefox\firefox.exe"

Upvotes: 3

phd443322
phd443322

Reputation: 503

Batch files wait for programs to exit unlike interactive. These are the rules documented in the Start command.

If Command Extensions are enabled, external command invocation through the command line or the START command changes as follows:

non-executable files may be invoked through their file association just by typing the name of the file as a command. (e.g. WORD.DOC would launch the application associated with the .DOC file extension). See the ASSOC and FTYPE commands for how to create these associations from within a command script.

When executing an application that is a 32-bit GUI application, CMD.EXE does not wait for the application to terminate before returning to the command prompt. This new behavior does NOT occur if executing within a command script.

When executing a command line whose first token is the string "CMD " without an extension or path qualifier, then "CMD" is replaced with the value of the COMSPEC variable. This prevents picking up CMD.EXE from the current directory.

When executing a command line whose first token does NOT contain an extension, then CMD.EXE uses the value of the PATHEXT environment variable to determine which extensions to look for and in what order. The default value for the PATHEXT variable is:

    .COM;.EXE;.BAT;.CMD

Notice the syntax is the same as the PATH variable, with
semicolons separating the different elements.

When searching for an executable, if there is no match on any extension, then looks to see if the name matches a directory name. If it does, the START command launches the Explorer on that path. If done from the command line, it is the equivalent to doing a CD /D to that path.

Upvotes: 1

Related Questions