Preventing false loading

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
SEOS
Posts: 4
Joined: 06 Aug 2013 12:59

Preventing false loading

#1 Post by SEOS » 06 Aug 2013 17:12

So I need a bit of help with my batch program.

I save like this.
(
echo variable1
echo variable2
) > save.sav

I load like this.
< save.sav (
set /p variable1=
set /p variable2=
)
goto town (It's setup like a game)

My save and load works but you can load without a sav file and if you do the game wont show the
variables because it sets them up when you do new game. I know people wont naturally select load without a save file but I'd like to make it
professional. So what I'd like is to know if I can do something like if there is no .sav file it will bring you back to menu.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Preventing false loading

#2 Post by foxidrive » 06 Aug 2013 20:12

Add this before the load routine:

Code: Select all

if not exist "*.sav" goto :menu

Post Reply