Answer» Okay .. Here it is:
I just started messing around with batch files etc, and i just ran into a problem .. I've made a fine menu (according to myself ), from wich i can execute some programs ..
I write for instance 1 and then i hit enter, and winamp opens .. No PROBLEMS there.. I've set it to go back to the front menu, when i've launched one of the programs .. And when i hit for instance 3 it starts rcon, and it SAYS RCON IS LOADING, which is fine .. But then after like 5 seconds i would want it to go back to main menu .. But, it doesn't .. I have to shut down rcon, before it goes back..
Is there any kind of command i can put in to make it go back after like 5 seconds, and not when the program is shutted down again? You GOT my problem?well i think if you post your script it would be easy to figure out besides just guessing whats wrong.ECHO off :start CLS ECHO / Welcome ECHO \ Choose a number below ECHO / and hit enter.. ECHO \ ECHO / 1. Start winamp ECHO \ 2. Start lectio ECHO / 3. Start rcon ECHO \ 4. Start xfire ECHO / 5. Start Ad-Aware ECHO \ 6. Start explorer ECHO / 7. Start PeerGuardian ECHO \ 8. Start Photoshop ECHO / 9. Start SPYBOT ECHO \ 10. Start avast! ECHO / 11. Exit set choice= set /p choice=Type the number to print text. if not '%choice%'=='' set choice=%choice:~0,1% if '%choice%'=='1' goto ONE if '%choice%'=='2' goto TWO if '%choice%'=='3' goto THREE if '%choice%'=='4' goto FOUR if '%choice%'=='5' goto FIVE if '%choice%'=='6' goto SIX if '%choice%'=='7' goto SEVEN if '%choice%'=='8' goto EIGHT if '%choice%'=='9' goto NINE if '%choice%'=='10' goto TEN if '%choice%'=='11' goto end ECHO "%choice%" is not valid please try again ECHO. goto start :ONE cls ECHO WINAMP LOADING win /m "C:\Program Files\Winamp\winamp.exe" goto start :TWO cls ECHO LECTIO LOADING win /m "http://www.lectio.dk/lectio/54/SkemaGenerator.aspx?type=elev&id=1367103984" goto start :THREE cls ECHO RCON LOADING win /m "C:\Program Files\Rcon Unlimited\Rcon Unlimited.exe" goto start :FOUR cls ECHO XFIRE LOADING win /m "C:\Program Files\Xfire\Xfire.exe" goto start :FIVE cls ECHO AD-AWARE LOADING win /m "C:\Program Files\Lavasoft\Ad-Aware SE Personal\Ad-Aware.exe" goto start :SIX cls ECHO EXPLORER LOADING win /m "C:\Program Files\Internet Explorer\IEXPLORE.EXE" goto start :SEVEN cls ECHO PEERGUARDIAN LOADING win /m "C:\Program Files\PeerGuardian2\pg2.exe" goto start :EIGHT cls ECHO PHOTOSHOP CS2 LOADING win /m "C:\Program Files\Graphics\Photoshop.exe" goto start :NINE cls ECHO SPYBOT LOADING win /m "C:\Program Files\Spybot - Search & Destroy\SpybotSD.exe" goto start :TEN cls ECHO AVAST! ANTIVIRUS LOADING win /m "C:\Program Files\Alwil Software\Avast4\ashAvast.exe" goto start :end
Okay .. i need it to go back to the main menu after it has done the ECHO LOADING .. After 5 seconds or such .. NOT when i close the program i chose to load..Try replacing win /m with the start command.
Ex:
start "C:\Program Files\Rcon Unlimited\Rcon Unlimited.exe"
The program will open in a separate address space and your batch file should continue back to the menu. (no 5 sec delay). If any of your options launch a 16-bit program, use the /separate switch with the start command to force a new address space.
Hope this helps. Hmm .. now i think i did as you suggested .. But when i try to load a program i just get this:
It does go back to the main screen, yes, but it doesn't start the program So i thought ... got more ideas? It should be possible...
Heres the new code: ECHO off :begin CLS ECHO / Welcome ECHO \ Choose a number below ECHO / and hit enter.. ECHO \ ECHO / 1. Start winamp ECHO \ 2. Start lectio ECHO / 3. Start rcon ECHO \ 4. Start xfire ECHO / 5. Start Ad-Aware ECHO \ 6. Start explorer ECHO / 7. Start PeerGuardian ECHO \ 8. Start Photoshop ECHO / 9. Start Spybot ECHO \ 10. Start avast! ECHO / 11. Exit set choice= set /p choice=Type the number to print text. if not '%choice%'=='' set choice=%choice:~0,1% if '%choice%'=='1' goto ONE if '%choice%'=='2' goto TWO if '%choice%'=='3' goto THREE if '%choice%'=='4' goto FOUR if '%choice%'=='5' goto FIVE if '%choice%'=='6' goto SIX if '%choice%'=='7' goto SEVEN if '%choice%'=='8' goto EIGHT if '%choice%'=='9' goto NINE if '%choice%'=='10' goto TEN if '%choice%'=='11' goto end ECHO "%choice%" is not valid please try again ECHO. goto begin :ONE cls ECHO WINAMP LOADING start "C:\Program Files\Winamp\winamp.exe" goto begin :TWO cls ECHO LECTIO LOADING start "http://www.lectio.dk/lectio/54/SkemaGenerator.aspx?type=elev&id=1367103984" goto begin :THREE cls ECHO RCON LOADING start "C:\Program Files\Rcon Unlimited\Rcon Unlimited.exe" goto begin :FOUR cls ECHO XFIRE LOADING start "C:\Program Files\Xfire\Xfire.exe" goto start :FIVE cls ECHO AD-AWARE LOADING start "C:\Program Files\Lavasoft\Ad-Aware SE Personal\Ad-Aware.exe" goto begin :SIX cls ECHO EXPLORER LOADING start "C:\Program Files\Internet Explorer\IEXPLORE.EXE" goto begin :SEVEN cls ECHO PEERGUARDIAN LOADING start "C:\Program Files\PeerGuardian2\pg2.exe" goto begin :EIGHT cls ECHO PHOTOSHOP CS2 LOADING start "C:\Program Files\Graphics\Photoshop.exe" goto begin :NINE cls ECHO SPYBOT LOADING start "C:\Program Files\Spybot - Search & Destroy\SpybotSD.exe" goto begin :TEN cls ECHO AVAST! ANTIVIRUS LOADING start "C:\Program Files\Alwil Software\Avast4\ashAvast.exe" goto begin :end endMany (if not most) Windows programs have components that must be loaded with the main program
Code: [Select] :NINE cls ECHO SPYBOT LOADING cd /d "C:\Program Files\Spybot - Search & Destroy" start SpybotSD.exe goto start
The strange thing is that the START works fine from the command line (go figure). I picked option nine since that was the only program we had in common but changes will have to be made for all the options.
Note: options 10 & 11 will give unpredictable results since your IF NOT statement restricts the length of the prompt reply to one byte!!
Good luck.
|