Command to delete text in another file

Microsoft / Dos 6.1
May 29, 2010 at 13:45:51
Specs: Windows 7 Ultimate, 4GB DDR2
Hello I want to save user preferences inside another batch file then run it. But sometimes settings change and instead of just setting the variable over and over I wanted to delete useless text inside it.

Code:

::commandshere

ECHO @ECHO OFF > user.bat
ECHO SET name=%name% >> user.bat

:task
::commandshere

SET /p location=Insert location here:
ECHO SET location=%location% >> user.bat
goto task

:changelocation
»FOR /F "SET /p location=%location%" in user.bat do delete«
::It doesn't necessarily have to be FOR command,
::it just needs to delete that.
SET /p location=Insert new location here:
goto task


Without that command user.bat would get this:

SET /p location=A
SET /p location=B
SET /p location=C
SET /p location=D


See More: Command to delete text in another file

Report •

#1
June 4, 2010 at 19:27:10

Report •
Related Solutions


Ask Question