Read/write variables from/to .txt file.

October 1, 2010 at 01:55:58
Specs: Windows 7
I have a .bat file that needs to write one variable to a .txt file if the file doesn't exist or read from it if it does. I also need it to save the .txt file in the same location as the .bat file. And if it reads the variable location and it doesn't exist, I need it to delete the .txt file and ask for input again.

@echo off
set /p var= Where is your world folder?
set /p var2= What kind of map would you like to use?
set /p var3= Where would you like to save it?
AlphaVespucci -p %var% %var2% -outputDir %var3%

From what I have gathered, you can write to a file by typing ">>C:\ echo %var%"

I'm not 100% on that part yet, but it's my guess from what I found.
After that I just need it to be able to check in the same folder as the .bat for the .txt. If it doesn't exist, take %var% and create it. It also needs to delete the .txt if it can't find %var%.

Thanks for any help.

See More: Read/write variables from/to .txt file.

Report •

October 1, 2010 at 13:25:17
Could someone please help me with this. I'd really like to get this working. It's gonna help quite a few people out.

Report •
Related Solutions

Ask Question