Here's one that I am actually working on currently.
You use INI files for the savegames, and load them with a dir command.
This is how I went about loading a list of savegames in.
The "." delimiter is so that it will not show the .ini extension, as not to confuse users. This however does not allow users to put periods in the savegame names.
set randomDirIndex=%random%dirindex
dir /b savegames\>%temp%\%randomDirIndex%
for /f "delims=." %%a in (%temp%\%randomDirIndex%) do (
echo %%a
)
Here's an example of the savegame INI file:
[PlayerStats]
health=100
energy=75
mana=50
[Inventory]
sword=1
key=0
[Info]
name=John Doe
I also used this question (check the first answer) to get the load INI script.
Now to load it you would use a series of for /f commands:
for /f "delims=" %%a in ('call ini.bat savegames\%~1.ini PlayerStats health') do (
set health=%%a
)
for /f "delims=" %%a in ('call ini.bat savegames\%~1.ini PlayerStats energy') do (
set energy=%%a
)
for /f "delims=" %%a in ('call ini.bat savegames\%~1.ini PlayerStats mana') do (
set mana=%%a
)
for /f "delims=" %%a in ('call ini.bat savegames\%~1.ini Inventory sword') do (
set hasSword=%%a
)
for /f "delims=" %%a in ('call ini.bat savegames\%~1.ini Inventory key') do (
set hasKey=%%a
)
for /f "delims=" %%a in ('call ini.bat savegames\%~1.ini Info name') do (
set playerName=%%a
)
And finally to save the game you just have to echo all of the things into a file, essentially rewriting the INI file. (refer to other people's answers.)