Jimmy Obonyo Abor
Jimmy Obonyo Abor

Reputation: 7875

Running Several batch Commands in Sequence

When i run this batch file command as a single batch file the second command does not run.However when i run them as individual batch file commands they work fine.

"C:\Program Files\Mozilla Firefox\firefox.exe" -P "america" -no-remote http://hakikahost.com/error.html
"nircmd.exe" win hide process "firefox.exe"

tried creating 1 single batch file which called with a call the two batch files now having separated the batch files command separately like this

call test.bat
call hide.bat

where test.bat contained the first command and hide.bat contained the second command but it still didnt work.What am i doing wrong?

Upvotes: 0

Views: 2000

Answers (2)

Magoo
Magoo

Reputation: 79982

The first command, "C:\Program Files\Mozilla Firefox\firefox.exe" does not return until the Fx session has ended (ie you EXIT from it)

Then there are no Fx executables so the second command can't hide the process that doesn't exist.

Try

START "" "C:\Program Files\Mozilla Firefox\firefox.exe" -P "america" -no-remote http://hakikahost.com error.html
"nircmd.exe" win hide process "firefox.exe"

The only difference is the START "" before the firefox-invocation. Note that the empty-quoted-string is required - you could enter a string between the quotes if you like - this becomes the window title.

Upvotes: 1

Nate Hekman
Nate Hekman

Reputation: 6657

It may be that firefox.exe never returns until you close the window. Try using start to launch the applications, as start will return as soon as the application has launched.

start "" "C:\Program Files\Mozilla Firefox\firefox.exe" -P "america" -no-remote http://hakikahost.com/error.html
start "" "nircmd.exe" win hide process "firefox.exe"

Upvotes: 1

Related Questions