Question Batch File Closes First Program

BasicConcept

Reputable
Dec 29, 2019
108
3
4,585
Hi all,

I have created a batch file in Windows 10 that should open all files/programs when I start the batch file and it looks like this:

@Echo off
start "Winamax.exe" "C:\Users\Ray\AppData\Local\Programs\winamax\Winamax.exe"
start "Updater.exe" "C:\Users\Ray\AppData\Roaming\NewGioco.it\Updater.exe
start "PartyGaming.exe" "C:\Programs\PartyGaming\PartyGaming.exe -P=PartyPoker"
start "JUICYPoker.exe" "C:\Program Files (x86)\Juicy Stakes 2.0\JUICYPoker.exe"
start "PokerKing.exe" "C:\PokerKing\PokerKing.exe"
exit

Here are a few issues I have:

The second line is completely ignored, nothing is starting and I am not sure why.
When I manually close the batch file, it closes the first program but leaves all other programs open.
The last line "exit" does not close the batch file at all.

Can someone explain what I am doing wrong?

Thank you!
 

BasicConcept

Reputable
Dec 29, 2019
108
3
4,585
which exact issue that the 2nd line didn't get call?
or the one that didn't close the all app? try taskkill

Sorry, by 2nd line I meant 2nd program. In this case I am speaking about the 3rd line (2nd program) that does not open although I believe that I specified the path correctly.

The 4th line (3rd program) does not work as it opens a pop up saying "Windows cannot find XXX. Make sure you typed the name correctly, and then try again.

And the batch file stays open. When I press X to close the window, it closes the first program specified in the batch file.

I am building a batch file for the first time and I am not sure what exactly is wrong.
 
I know that extra parameters should be given AFTER the quotation mark.
so
start "PartyGaming.exe" "C:\Programs\PartyGaming\PartyGaming.exe" -P=PartyPoker
should work as far as launching it goes.

and that final exit might need to be
exit /b
since that is for closing batch files. not tested this myself but internet seems to be somewhat divided what works, some say that you should have cmd /c before each start line
so each line should resemble this:
cmd /c start "PartyGaming.exe" "C:\Programs\PartyGaming\PartyGaming.exe" -P=PartyPoker

I do not have same applications as you so I cannot say what is wrong but for my test script of opening X number of files on notepad, it seems to work and closes the batch file once completed without exit /b

it might be getting stuck to that failed partygaming.exe line
 

BasicConcept

Reputable
Dec 29, 2019
108
3
4,585
I know that extra parameters should be given AFTER the quotation mark.
so
start "PartyGaming.exe" "C:\Programs\PartyGaming\PartyGaming.exe" -P=PartyPoker
should work as far as launching it goes.

and that final exit might need to be
exit /b
since that is for closing batch files. not tested this myself but internet seems to be somewhat divided what works, some say that you should have cmd /c before each start line
so each line should resemble this:
cmd /c start "PartyGaming.exe" "C:\Programs\PartyGaming\PartyGaming.exe" -P=PartyPoker

I do not have same applications as you so I cannot say what is wrong but for my test script of opening X number of files on notepad, it seems to work and closes the batch file once completed without exit /b

it might be getting stuck to that failed partygaming.exe line

So the Partygaming is now opening successfully and that works.

The only issue that remains is that the batch is not closing, regardless if it is exit or exit /b .

And when the batch stays open and I press X, it still closes the first program.

Any advice on that?
 

BasicConcept

Reputable
Dec 29, 2019
108
3
4,585
I would use call instead of start.
Call path\filensme parameters

then it won’t close them
Can you tell me what to write exactly? I am doing it for the first time.

I want that the batch file closes if possible since having it in the taskbar is kinda annoying.

So instead of start I put call and that should fix it?
 
D

Deleted member 14196

Guest
Example

call "C:\Programs\PartyGaming\PartyGaming.exe" -P=PartyPoker


Call "C:\Users\Ray\AppData\Roaming\NewGioco.it\Updater.exe

call “C:\Program Files (x86)\Juicy Stakes 2.0\JUICYPoker.exe"



that should do it. No need for exit. The batch language is very primitive. Don’t treat it like a real programming language because it’s not. It’s actually the crappiest batch processor ever. I wish they would’ve just use bash instead.
 
Last edited by a moderator:

BasicConcept

Reputable
Dec 29, 2019
108
3
4,585
Example

call "C:\Programs\PartyGaming\PartyGaming.exe" -P=PartyPoker


Call "C:\Users\Ray\AppData\Roaming\NewGioco.it\Updater.exe

call “C:\Program Files (x86)\Juicy Stakes 2.0\JUICYPoker.exe"



that should do it. No need for exit. The batch language is very primitive. Don’t treat it like a real programming language because it’s not. It’s actually the crappiest batch processor ever. I wish they would’ve just use bash instead.

I did it this as you said and it opens only the first program, not the rest of the programs.

The batch is also still open after starting.

Also when closing the batch, it closes the first program.

Didn't really change anything sadly.
 
D

Deleted member 14196

Guest
Use autoit or other scripting language. Batch is GARBAGE

Google what it is you want to do and use autoIT in the search. You will find a script most likely.

I’m not going to write your script for you. Look somewhere else for that. You need to learn how to do things yourself.

replace call with

cmd /c

try that or use a different tool. It still may not work
 
  • Like
Reactions: Grobe

BasicConcept

Reputable
Dec 29, 2019
108
3
4,585
I have been able to use batch and script everything correctly. There is, however, one and only program that does not want to open and I am sure the line is right. The script is like this:

@Echo off

start "VBet.exe" "C:\Users\Ray\AppData\Local\VBetPoker\VBet.exe"

exit

If I add any other program into this line it opens without issues but this one won't. I also have a log file I can upload, just not sure how (if needed).

Can anyone advice why nothing happens when I double click the batch?
 
I do not have solution as to why that vbet.exe wont start but following might give clues to why.

add pause line right after each program you are starting with the batch, it causes batch to pause (you need to press any key while batch file is in focus)
this prevents it from closing while troubleshooting and/or seeing error messages if any that are given when running the command.

start "VBet.exe" "C:\Users\Ray\AppData\Local\VBetPoker\VBet.exe"
pause
exit

another thing to try is to reverify the path and if said program CAN be launched without extra parameters.
try that by going to C:\Users\Ray\AppData\Local\VBetPoker with explorer and double clicking on vbet.exe to run it.
it is also possible that said Vbet requires working directory to be right for whatever reason, so you could need, this is not likely since I cannot remember last time when working directory was critical issue.
cd "c:\users\ray\appdata\local\vbetpoker" before the line where you start it.
 
It seems that bat files in W10 just exit in the midst of lines isn't exactly something new.

For some months ago, I experienced such issue myself having some if sentences that whatever code below a certain point would never execute. I made a thread also, but no obvious solution found.

If possible, I agree to what Mandark wrote above. I think most other script languages will do better, even vbs files. Personally I prever Autohotkey on Windows, but I also try to learn Phyton because I won't be locked to one OS.
 

BasicConcept

Reputable
Dec 29, 2019
108
3
4,585
I do not have solution as to why that vbet.exe wont start but following might give clues to why.

add pause line right after each program you are starting with the batch, it causes batch to pause (you need to press any key while batch file is in focus)
this prevents it from closing while troubleshooting and/or seeing error messages if any that are given when running the command.

start "VBet.exe" "C:\Users\Ray\AppData\Local\VBetPoker\VBet.exe"
pause
exit

another thing to try is to reverify the path and if said program CAN be launched without extra parameters.
try that by going to C:\Users\Ray\AppData\Local\VBetPoker with explorer and double clicking on vbet.exe to run it.
it is also possible that said Vbet requires working directory to be right for whatever reason, so you could need, this is not likely since I cannot remember last time when working directory was critical issue.
cd "c:\users\ray\appdata\local\vbetpoker" before the line where you start it.

Where exactly do I put the cd?

start "VBet.exe" cd "C:\Users\Ray\AppData\Local\VBetPoker\VBet.exe"

Like this? Because that does not work. All other solutions did not work sadly.
 

BasicConcept

Reputable
Dec 29, 2019
108
3
4,585
It seems that bat files in W10 just exit in the midst of lines isn't exactly something new.

For some months ago, I experienced such issue myself having some if sentences that whatever code below a certain point would never execute. I made a thread also, but no obvious solution found.

If possible, I agree to what Mandark wrote above. I think most other script languages will do better, even vbs files. Personally I prever Autohotkey on Windows, but I also try to learn Phyton because I won't be locked to one OS.

I wanted just a simple script and did not want to dig much time into downloading and getting other programs and languages ... but maybe there's no other way, dunno
 

BasicConcept

Reputable
Dec 29, 2019
108
3
4,585
Thanks to your help all I was able to create my script that opens all of the programs. Some programs needed changes otherwise they won't open. Here it is:


@Echo off

start "Lobby.exe" "C:\Users\Ray\AppData\Roaming\NewGioco.it\Lobby.exe"
start /wait "Launcher.exe" "C:\Program Files (x86)\TigerGaming\Launcher.exe"
start "launcher.exe" "C:\Program Files (x86)\GGPoker\launcher.exe"
start "Winamax.exe" "C:\Users\Ray\AppData\Local\Programs\winamax\Winamax.exe"
start "PartyGaming.exe" "C:\Programs\PartyGaming\PartyGaming.exe" -P=PartyPoker
start "casino.exe" "C:\Users\Ray\AppData\Local\win2day Poker\casino.exe"
start "888poker.exe" "C:\Users\Ray\AppData\Roaming\Poker\PacificPoker\bin\888poker.exe"
start "JUICYPoker.exe" "C:\Program Files (x86)\Juicy Stakes 2.0\JUICYPoker.exe"
start "PokerKing.exe" "C:\PokerKing\PokerKing.exe"
start "Launcher.exe" "C:\Program Files (x86)\Pokerdom.com\Launcher.exe"
start "Loader.exe" "C:\Users\Ray\AppData\Local\SwC Poker\Loader.exe"
start "casino.exe" "C:\Users\Ray\AppData\Local\Betfair Poker\casino.exe"
start "IgnitionCasino.exe" "C:\Program Files (x86)\Ignition Casino Poker\IgnitionCasino.exe"
cd "C:\Users\Ray\AppData\Local\VBetPoker"
start Vbet.exe

exit

The only and last issue is that the batch file does not close itself after I double click it. Anyone knows why? If I manually close it it closes 1-2 programs as well. It's strange.
 
I do not have mentioned programs to test but that second line start /wait says:
Start application and wait for it to terminate, (visible when you type start /? in command prompt)
which I think causes the launcher to be tied to existance of the batch file.

it is good to hear that the working directory trick worked for the VBet though.


windows has alternatives to start, some of which you have already tested but I'll list them anyway.
cmd /c
call

first though, you would need to identify the programs that close when closing the batch file, are they always same? if so, you could try changing on how you run them to either cmd /c or call

if you are using cmd /c, you need to try using it BEFORE the start and replacing the start

cmd /c start "PokerKing.exe" "C:\PokerKing\PokerKing.exe"
cmd /c "C:\PokerKing\PokerKing.exe"
call "C:\PokerKing\PokerKing.exe"

the lack of exiting has alternatives but I'd think that any of them would also act same as when you manually close it, closes some of the run programs so handling that first is the key.

possible extra ways to close it:
add second/third line of exit in the end, in case batch thinks it has multiple layers of inside each other
for this exit /b should also work, so
exit /b
exit
might or might not work.


if you do not have any other batch files running, you could use taskkill as last line to simply kill cmd.exe's
taskkill /im cmd.exe /f
that is NOT advisable though if you have any other batch files or command prompts open, it will forcefully close them all.
another, possibly due to bug way of closing stuff is to have following line as the last one:
move nul 2>&0


That is about all I can think of. Testing on batch files is tricky since different programs work differently and without same set, it is hard or impossible to get same results.

If goal is to launch those when you log into windows though, you could use windows scheduler to start them on login, it would circumvent the batch file need and allow you to run them.
 

BasicConcept

Reputable
Dec 29, 2019
108
3
4,585
I do not have mentioned programs to test but that second line start /wait says:
Start application and wait for it to terminate, (visible when you type start /? in command prompt)
which I think causes the launcher to be tied to existance of the batch file.

it is good to hear that the working directory trick worked for the VBet though.


windows has alternatives to start, some of which you have already tested but I'll list them anyway.
cmd /c
call

first though, you would need to identify the programs that close when closing the batch file, are they always same? if so, you could try changing on how you run them to either cmd /c or call

if you are using cmd /c, you need to try using it BEFORE the start and replacing the start

cmd /c start "PokerKing.exe" "C:\PokerKing\PokerKing.exe"
cmd /c "C:\PokerKing\PokerKing.exe"
call "C:\PokerKing\PokerKing.exe"

the lack of exiting has alternatives but I'd think that any of them would also act same as when you manually close it, closes some of the run programs so handling that first is the key.

possible extra ways to close it:
add second/third line of exit in the end, in case batch thinks it has multiple layers of inside each other
for this exit /b should also work, so
exit /b
exit
might or might not work.


if you do not have any other batch files running, you could use taskkill as last line to simply kill cmd.exe's
taskkill /im cmd.exe /f
that is NOT advisable though if you have any other batch files or command prompts open, it will forcefully close them all.
another, possibly due to bug way of closing stuff is to have following line as the last one:
move nul 2>&0


That is about all I can think of. Testing on batch files is tricky since different programs work differently and without same set, it is hard or impossible to get same results.

If goal is to launch those when you log into windows though, you could use windows scheduler to start them on login, it would circumvent the batch file need and allow you to run them.

After further testing I came to this best result after adding a line one by one and seeing if it causes any issues:

@Echo off

cmd /c start "Launcher.exe" "C:\Program Files (x86)\Pokerdom.com\Launcher.exe"
cmd /c "C:\Program Files (x86)\Pokerdom.com\Launcher.exe"
call "C:\Program Files (x86)\Pokerdom.com\Launcher.exe"

cmd /c start "Lobby.exe" "C:\Users\Ray\AppData\Roaming\NewGioco.it\Lobby.exe"
cmd /c "C:\Users\Ray\AppData\Roaming\NewGioco.it\Lobby.exe"
call "C:\Users\Ray\AppData\Roaming\NewGioco.it\Lobby.exe"

cmd /c start "launcher.exe" "C:\Program Files (x86)\GGPoker\launcher.exe"
cmd /c "C:\Program Files (x86)\GGPoker\launcher.exe"
call "C:\Program Files (x86)\GGPoker\launcher.exe"

cmd /c start "Winamax.exe" "C:\Users\Ray\AppData\Local\Programs\winamax\Winamax.exe"
cmd /c "C:\Users\Ray\AppData\Local\Programs\winamax\Winamax.exe"
call "C:\Users\Ray\AppData\Local\Programs\winamax\Winamax.exe"

cmd /c start "PartyGaming.exe" "C:\Programs\PartyGaming\PartyGaming.exe" -P=PartyPoker
cmd /c "C:\Programs\PartyGaming\PartyGaming.exe" -P=PartyPoker
call "C:\Programs\PartyGaming\PartyGaming.exe" -P=PartyPoker

start "casino.exe" "C:\Users\Ray\AppData\Local\win2day Poker\casino.exe"

start "888poker.exe" "C:\Users\Ray\AppData\Roaming\Poker\PacificPoker\bin\888poker.exe"

start "JUICYPoker.exe" "C:\Program Files (x86)\Juicy Stakes 2.0\JUICYPoker.exe"

start "PokerKing.exe" "C:\PokerKing\PokerKing.exe"

start "casino.exe" "C:\Users\Ray\AppData\Local\Betfair Poker\casino.exe"

start "IgnitionCasino.exe" "C:\Program Files (x86)\Ignition Casino Poker\IgnitionCasino.exe"

cd "C:\Users\Ray\AppData\Local\VBetPoker"
start VBet.exe

start "SwCPoker.exe" "C:\Users\Ray\AppData\Local\SwC Poker\SwCPoker.exe"

exit

All programs open and the batch file closes basically right away. AWESOME!

Here is one issue:

If I add this program (start "Launcher.exe" "C:\Program Files (x86)\TigerGaming\Launcher.exe") then we are back at the same problem as before. The batch file stays open but at least all programs are open. If I close the batch file, the only program that closes (which is always the same one) is PokerKing.
---------------------
If I add the command that you suggest to PokerKing like this

cmd /c start "PokerKing.exe" "C:\PokerKing\PokerKing.exe"
cmd /c "C:\PokerKing\PokerKing.exe"
call "C:\PokerKing\PokerKing.exe"

then the programs starts three times or so which is not ideal.
-----------------------
If I only isolate TigerGaming and PokerKing like this

@Echo off

start "PokerKing.exe" "C:\PokerKing\PokerKing.exe"

start "Launcher.exe" "C:\Program Files (x86)\TigerGaming\Launcher.exe"

exit

Then it also works perfectly (batch file closing).
---------------------

If I take my whole working script with the program that causes issues (TigerGaming) and add move nul 2>&0 as the last line, nothing changes.
---------------------
If I add
exit /b
exit

as my last two lines, it prompts me to say Y or N in CMD for some reason which is more click/type work which I want to avoid.

Any suggestions? For now I left TigerGaming out of the script and all works well but I'd love to have it in the script if we know what causes the issue.

And idea?
 
well, I meant to use/test one of the options for each program
cmd /c start
or
cmd /c
or
call
not all of them since that basically means starting it up 3 times.
this is kind of moot point now though if you have it running as you want.

I have no idea why having tigergames launcher in it causes it to not complete and exit AND causes pokerking to close if you close the batch file manually.

you could try creating two batch files, one launching the

@Echo off
start "Launcher.exe" "C:\Program Files (x86)\TigerGaming\Launcher.exe"
exit
and another having everything else in main batch file with last line before exit being
call "c:\path-to-batch-file\batchfilefortigergameslauncher.bat"
to run the remaining things.

It might allow things to work. Not ideal, not perfect but there are clearly some unknown problems in getting these to run correctly.

Only remaining option is to see if adding delay/timeout between running programs would help it to work, giving programs bit more time time to run before starting next one.
to wait 3 seconds between launching things, you would have this between each line (except that cd Vbet, that doesn't need it)
Timeout /t 3

past those two things, my bucket of how to work around these "doesn't run or if runs, doesn't work correctly" batchfile problems is pretty much empty in "what to test or try" category.