保存许多命令的输出

使用许多 ECHO 命令创建批处理文件:

(
  echo echo hi, this is the date today
  echo date /T
  echo echo created on %DATE%
  echo pause >nul
)>hi.bat

命令解释器将括号中的整个部分视为单个命令,然后将所有输出保存到 hi.bat

hi.bat 现在包含:

echo hi, this is the date today
date /T
echo created on [date created]
pause >nul