Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Other Scripting Languages (http://www.programmingforums.org/forum39.html)
-   -   Need Batch Help (http://www.programmingforums.org/showthread.php?t=11520)

Darkicon Oct 8th, 2006 1:56 AM

Need Batch Help
 
I am writing simple batch files for installing my mods for Star Wars Battlefront 2, but I am having a problem with it. Here is my script so far:

:

@echo off
cls
echo Hello, welcome to Darkicon's Star Wars Battlefront II mod installer!
pause
echo Would you like to install Civil War Elimination on Geonosis?
echo Y Yes
echo N No
CHOICE /C:yn Choose an option.
IF errorlevel 2 GOTO No
IF errorlevel 1 GOTO Yes
:Yes
echo Deleting original "mission.lvl".
del C:\Program Files\LucasArts\Star Wars Battlefront II\GameData\data\_lvl_pc\mission.lvl
echo Moving Civil War Elimination on Geonosis "mission.lvl".
copy C:\XL Civil War Geo\mission.lvl C:\Program Files\LucasArts\Star Wars Battlefront II\GameData\data\_lvl_pc\
pause
echo All done! Have fun!
:No
GOTO End
:End
echo Goodbye!
pause
exit


When I execute it, it just closes.

Thank you.

PhilBon Oct 8th, 2006 4:18 AM

Try putting Quotes " " around any filename that has a space. Also searchh online for batch files that deal with
:

echo Y Yes
echo N No
CHOICE /C:yn Choose an option.
IF errorlevel 2 GOTO No
IF errorlevel 1 GOTO Yes

Not to sure about that

The Dark Oct 8th, 2006 9:07 AM

Get rid of the @echo off for now and run it from the command prompt, rather than clicking the icon. That way you will get to see how far down the script it gets before it finishes and you will also see any error messages.

AntiNinja Oct 8th, 2006 1:24 PM

If I remember correctly 'CHOICE' only works on 9x so try using this:
:

set /p user=Enter Y/N
IF %user% EQU N GOTO NO
IF %user% EQU Y GOTO YES

Instead of this:
:

echo Y Yes
echo N No
CHOICE /C:yn Choose an option.
IF errorlevel 2 GOTO No
IF errorlevel 1 GOTO Yes


Darkicon Oct 8th, 2006 3:25 PM

Wow thanks.

The new choice command and the quotes around the paths worked.

Now I need help with this. It's the uninstaller. When I run it, it says it can't find the path, a bad syntax for renaming, etc.

Nevermind, I just messed up where I put the quotes.


All times are GMT -5. The time now is 1:00 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC