Solved How do I save input from a batch to a txt?

June 2, 2017 at 22:36:49
Specs: Windows 10
I'm making a batch game, and I want to make it to save user input and changed variables to a .txt and be able to access it the next time the game is opened. I know how to put the input in a .txt doc but I don't know how get the input from said .txt to the batch game the next time it's opened.

See More: How do I save input from a batch to a txt?

Report •

June 2, 2017 at 23:09:29
Post a few lines of your txt file.

2017-06-03 13:09:57.82 GMT +7


M2 Get custom script or take private lessons

Report •

June 3, 2017 at 00:30:31
I don't have alot, but here's what I have:

@echo off
if not exist King.txt echo.>>King.txt
title King
color 0a
set /a money=0
set /a health=100
set /a level=1
set /a atk=10
set /a def=20
set /a skillPoint=0

echo 1.) Start New Game
echo 2.) Load Game
echo 3.) Leave
set /p input=Choose a Number:
if not defined input goto intro
if %input%== 1 goto getName
If %input%== 2 goto loadGame
if %input%== 3 exit

echo What do you want your name to be?
set /p playername=

echo Please select a gender (male/female)
set /p gender=
goto beginning

Report •

June 6, 2017 at 01:19:47
✔ Best Answer
Save file looks like this:


Then load the data like this:
for /f "tokens=1,* delims==" %%A in (savedata.txt) do (
	set "%%A=%%B"

Don't worry if plan A fails, there are 25 more letters in the alphabet ;)

Report •
Related Solutions

Ask Question