标题: [文本处理] [已解决]批处理如何向文本输入pause? [打印本页]
作者: crist 时间: 2011-12-22 19:51 标题: [已解决]批处理如何向文本输入pause?
- echo>>2.cmd @echo off
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- echo pause >>2.cmd
复制代码
运行正常- echo>>2.cmd @echo off
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- echo>>2.cmd pause
复制代码
2.cmd最后一行变成“ECHO 处于打开状态。”
如果把echo>>2.cmd pause改成echo>>2.cmd pause ^>nul ^>nul,结果2.cmd最后一行变成pause >nul 2>nul
请问这是什么原因呢?
作者: powerbat 时间: 2011-12-22 20:17
最后一行后面没有回车
echo>file text
这种写法中,行结束符可能影响cmd的预处理。
echo text>file
>file echo text
则没有问题。
作者: crist 时间: 2011-12-22 22:20
回复 2# powerbat
原来是末行没回车导致的问题,真是没想到
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |