好的,我今天的问题显然非常困难,按标题我的任务似乎并不困难,但相信我,这不是你通常的任务。
我想要做的是运行一个批处理文件来编译另一个批处理文件,其中设置了一个正在运行的批处理文件中的变量。不过,这就是问题所在。我不想从编码中编写批处理文件。这就是我的意思。
这是完成的批处理文件的示例。
@echo off
color a
title my compiled batch
echo.
echo.
echo This is the batch file that was compiled from the one I was using to create it.
echo.
echo.
pause
exit
这是您最有可能想到的编译器。
[new.bat]
@echo off
color a
cls
echo.
echo type your name.
echo.
echo.
set input=
set /p input=Name: ( I typed "my compiled batch" in this input area)
echo @echo off >>new.bat
echo color a >>new.bat
echo title %input% >>new.bat
echo echo. >>new.bat
echo echo. >>new.bat
echo This is the batch file that was compiled from the one I was using to create it. >>new.bat
echo echo. >>new.bat
echo echo. >>new.bat
echo pause >>new.bat
echo exit >>new.bat
这是我希望能够看到它的 784 行有多长。
echo "@echo off
color a
title my compiled batch
echo.
echo.
echo This is the batch file that was compiled from the one I was using to create it.
echo.
echo.
pause
exit" >> new.bat
所以基本上我想将批处理文件编译为单个字符串,但它仍然进入“new.bat”,就好像我自己编写了它一样。
反正有这样做吗?