I want to but this in to an other .bat file
echo %random% > test.bat
set /a num= +1
:repeat1
set /a num= +1
echo %random% >> test.bat
if ==100 goto end
goto repeat1
So I have tried with this:
echo echo %every%%random%%random%%random%%random% > "output.txt" > test.bat
echo set /a num=%num% +1 >> test.bat
echo :repeat1 >> test.bat
echo set /a num=%num% +1 >> test.bat
echo echo %every%%random%%random%%random%%random% >> "output.txt" >> test.bat
echo if %num%==%amount% goto end >> test.bat
echo goto repeat1 >> test.bat
:end >> test.bat
But the %% things don't work (it will put a random nummer but I want to have %random% in the new .bat file
you have to escape some chars if you want to write them literally. Most of them are escaped with a caret
^
(&
,<
,>
,|
). The percent sign is an exception: it is escaped with another percent-sign:`But may I suggest another method to write your second bat file (without caring for characters to escape):
The
for
is used to determine the start line of the data to be written,more +n
writes the file ("~dpnx0"
is the currently running batchfile) by skipping the firstn
lines.Pro: no need to escape anything - just write the data as it should be outputted.
Contra: only one "second file" possible; only static text possible.