So I am trying to make a running batch file to create a new batch file which contains:
@setlocal enableextensions enabledelayedexpansion
@echo off
:remloop
set recfilepath=%pof%
set filename=%pof%
SET filename=%_filename:*\=%
if not x%pof:bcd=%==x%pof% goto remloop
endlocal
(Variable POF has already been declared in another file) So I tried using echo command to make another batch file
echo @setlocal enableextensions enabledelayedexpansion > file2.bat
echo @echo off > file2.bat
echo :remloop >> file2.bat
echo set recfilepath=%pof% >> file2.bat
echo set filename=%pof% >> file2.bat
echo SET filename=%_filename:*\=% >> file2.bat
echo if not x%pof:bcd=%==x%pof% goto remloop >> file2.bat
echo endlocal >> file2.bat
but the result was unexpected, the results are:
@echo off
:remloop
set recfilepath=C:\Users\Palm2570Playz\Desktop\djfbjfbfbj.txt
set filename=C:\Users\Palm2570Playz\Desktop\djfbjfbfbj.txt
SET filename=*\=
if not xC:\Users\Palm2570Playz\Desktop\djfbjfbfbj.txt==xC:\Users\Palm2570Playz\Desktop\djfbjfbfbj.txt goto remloop
endlocal
The "SET filename=*= " lines was unexpected so the code cannot run correctly Is there any command to fix this?