1.

Solve : Displaying Data From A .txt?

Answer»

I am in the PROCESS of making a simple TEXT based game.
My Batch file outputs the current data by means of:
Code: [Select]cls
echo Saving Data, Please Wait...
DEL %b%.txt
echo %a% >> %b%.txt
echo %b% >> %b%.txt
echo %c% >> %b%.txt
echo %d% >> %b%.txt
echo %e% >> %b%.txt
echo %f% >> %b%.txt
echo 1 >>%b%.txt
echo MP5 >>%b%.txt
echo Silencer >>%b%.txt
echo GAS Mask >>%b%.txt
echo SAS "Corporal Smith's Unit" >>%b%.txt

Although I Would Like To Reload This When They Ask For It:
I have this so far
Code: [Select]:LOADGAME
cls
echo Please Enter Your First Name:
echo.
set /p firstname=First Name:
echo.
echo <%firstname%.txt //this does not work
pause >nul

I Would like the data to be displayed like:

--Current Statistics--
Surname: (THEIR SURNAME)
First Name: (THEIR FIRST NAME)
Occupation: (THEIR OCCUPATION)
and so on.....

Any Help Appreciated.can this actually be done?Instead of this:
Code: [Select]echo <%firstname%.txt
I think you want this:
Code: [Select]type %firstname%.txtI think you are looking for this:

Code: [Select]echo Surname: %surname% >>"C:\Documents and Settings\%username%\Desktop\file.txt"
echo First Name: %firstname% >>"C:\Documents and Settings\%username%\Desktop\file.txt"
echo Occupation: %occupation% >>"C:\Documents and Settings\%username%\Desktop\file.txt"UNLESS the batch prog is working in the same directory as the files.Yes, otherwise it would just be %surname% >> File.txti want to load the data not output it.

thats why i used < not >> or >.Quote from: KenJackson on June 01, 2008, 10:52:32 AM

Instead of this:
Code: [Select]echo <%firstname%.txt
I think you want this:
Code: [Select]type %firstname%.txt

Thanks Very Much.


Discussion

No Comment Found