Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Oct 8th, 2006, 12:56 AM   #1
Darkicon
Newbie
 
Join Date: Oct 2006
Posts: 2
Rep Power: 0 Darkicon is on a distinguished road
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.
Darkicon is offline   Reply With Quote
Old Oct 8th, 2006, 3:18 AM   #2
PhilBon
Hobbyist Programmer
 
PhilBon's Avatar
 
Join Date: Nov 2005
Posts: 172
Rep Power: 3 PhilBon is on a distinguished road
Send a message via AIM to PhilBon Send a message via MSN to PhilBon
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
PhilBon is offline   Reply With Quote
Old Oct 8th, 2006, 8:07 AM   #3
The Dark
Expert Programmer
 
Join Date: Jun 2005
Posts: 824
Rep Power: 4 The Dark is on a distinguished road
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.
The Dark is offline   Reply With Quote
Old Oct 8th, 2006, 12:24 PM   #4
AntiNinja
Hobbyist Programmer
 
AntiNinja's Avatar
 
Join Date: Jun 2006
Location: The States
Posts: 101
Rep Power: 3 AntiNinja is on a distinguished road
Send a message via AIM to AntiNinja Send a message via Yahoo to AntiNinja
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
__________________
Pain is just weakness leaving the body.
AntiNinja is offline   Reply With Quote
Old Oct 8th, 2006, 2:25 PM   #5
Darkicon
Newbie
 
Join Date: Oct 2006
Posts: 2
Rep Power: 0 Darkicon is on a distinguished road
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.
Darkicon is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Batch Question NightShade01 Other Programming Languages 3 Jun 20th, 2006 5:39 PM
Embedding a batch file into a C++ app vynkz C++ 22 May 18th, 2005 8:59 PM
Batch Files Skinner Other Programming Languages 4 Apr 28th, 2005 8:03 AM
MSDOS Batch Desktop arrange dingbat Other Web Development Languages 3 Apr 13th, 2005 5:33 AM
Update registry key value via batch file dpasswat Other Scripting Languages 1 Mar 17th, 2005 10:45 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 9:26 AM.

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