运行以下代码,然后执行生成的test.bat,你就知道该怎么弄了。主要思想是用echo语句把内容重定向到另一个批处理中去,但是要注意对%及重定向符号、管道符号等进行转义操作:
@echo off
>test.bat echo @echo off
>>test.bat echo echo 今天的日期是:%%date%%
>>test.bat echo echo.
>>test.bat echo echo 当前盘符是 %%cd:~0,1%%
>>test.bat echo echo.
>>test.bat echo echo 按任意键退出...
>>test.bat echo pause^>nul
Last edited by namejm on 2006-10-17 at 12:25 ]