[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[文本处理] [已解决]批处理如何向文本输入pause?

  1. echo>>2.cmd @echo off
  2. echo>>2.cmd reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\4080110900063D11C8EF10054038389C\Patches\B4F5179064BDB424182F1D0B00C98CF6" /v "MSI3" /t "reg_dword" /d "1" /f
  3. echo>>2.cmd reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\4080110900063D11C8EF10054038389C\Patches\B4F5179064BDB424182F1D0B00C98CF6" /v "State" /t "reg_dword" /d "1" /f
  4. echo>>2.cmd reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\4080110900063D11C8EF10054038389C\Patches\B4F5179064BDB424182F1D0B00C98CF6" /v "Uninstallable" /t "reg_dword" /d "0" /f
  5. echo>>2.cmd reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\4080110900063D11C8EF10054038389C\Patches\B4F5179064BDB424182F1D0B00C98CF6" /v "LUAEnabled" /t "reg_dword" /d "0" /f
  6. echo>>2.cmd reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\4080110900063D11C8EF10054038389C\Patches\B4F5179064BDB424182F1D0B00C98CF6" /v "PatchType" /t "reg_dword" /d "0" /f
  7. echo>>2.cmd reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\4080110900063D11C8EF10054038389C\Patches\B4F5179064BDB424182F1D0B00C98CF6" /v "Installed" /d "%date:~0,4%%date:~5,2%%date:~8,2%" /f
  8. echo>>2.cmd reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\4080110900063D11C8EF10054038389C\Patches\B4F5179064BDB424182F1D0B00C98CF6" /v "DisplayName" /d "Update for Outlook 2003: Junk E-mail Filter (KB2596520): OUTLFLTR" /f
  9. echo>>2.cmd reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\4080110900063D11C8EF10054038389C\Patches\B4F5179064BDB424182F1D0B00C98CF6" /v "MoreInfoURL" /d "http://support.microsoft.com/kb/2596520" /f
  10. echo pause >>2.cmd
复制代码
运行正常
  1. echo>>2.cmd @echo off
  2. echo>>2.cmd reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\4080110900063D11C8EF10054038389C\Patches\B4F5179064BDB424182F1D0B00C98CF6" /v "MSI3" /t "reg_dword" /d "1" /f
  3. echo>>2.cmd reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\4080110900063D11C8EF10054038389C\Patches\B4F5179064BDB424182F1D0B00C98CF6" /v "State" /t "reg_dword" /d "1" /f
  4. echo>>2.cmd reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\4080110900063D11C8EF10054038389C\Patches\B4F5179064BDB424182F1D0B00C98CF6" /v "Uninstallable" /t "reg_dword" /d "0" /f
  5. echo>>2.cmd reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\4080110900063D11C8EF10054038389C\Patches\B4F5179064BDB424182F1D0B00C98CF6" /v "LUAEnabled" /t "reg_dword" /d "0" /f
  6. echo>>2.cmd reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\4080110900063D11C8EF10054038389C\Patches\B4F5179064BDB424182F1D0B00C98CF6" /v "PatchType" /t "reg_dword" /d "0" /f
  7. echo>>2.cmd reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\4080110900063D11C8EF10054038389C\Patches\B4F5179064BDB424182F1D0B00C98CF6" /v "Installed" /d "%date:~0,4%%date:~5,2%%date:~8,2%" /f
  8. echo>>2.cmd reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\4080110900063D11C8EF10054038389C\Patches\B4F5179064BDB424182F1D0B00C98CF6" /v "DisplayName" /d "Update for Outlook 2003: Junk E-mail Filter (KB2596520): OUTLFLTR" /f
  9. echo>>2.cmd reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\4080110900063D11C8EF10054038389C\Patches\B4F5179064BDB424182F1D0B00C98CF6" /v "MoreInfoURL" /d "http://support.microsoft.com/kb/2596520" /f
  10. echo>>2.cmd pause
复制代码
2.cmd最后一行变成“ECHO 处于打开状态。”

如果把echo>>2.cmd pause改成echo>>2.cmd pause ^>nul ^>nul,结果2.cmd最后一行变成pause >nul 2>nul

请问这是什么原因呢?
1

评分人数

    • CrLf: 感谢给帖子标题标注[已解决]字样PB + 2

回复 2# powerbat


    原来是末行没回车导致的问题,真是没想到

TOP

最后一行后面没有回车
echo>file text
这种写法中,行结束符可能影响cmd的预处理。
echo text>file
>file echo text
则没有问题。
1

评分人数

    • CrLf: 学习了技术 + 1

TOP

返回列表