Tuesday, 15 February 2011

Using a .bat to edit another file -



Using a .bat to edit another file -

i know how utilize .bat file edit file in same folder.

in example, working on text based game.

i have main file (.bat) edit specific lines on file (if possible .bat)

an illustration made up

file 1:

@echo off echo alter stats +1 stats echo press 1 set /p choice= if %choice% == goto chstats pause :chstats

(what need go here)

file2:

@echo off set atklvl= 1 set deflvl= 1 echo player stats echo attack: %atklvl% echo def: %deflvl% pause

you can write text file within dos batch file. seek putting simple illustration text in test.bat file. create two-line output file named test.txt. first line contain aaaa. sec line contain bbb bbb.

echo aaaa > c:\test.txt echo bbb bbb >> c:\test.txt

if need simple can work well. if not, might want seek scripting language python or windows powershell.

batch-file

No comments:

Post a Comment