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

[系统相关] [已解决]批处理为何提示“系统找不到指定的路径”错误?

本帖最后由 crist 于 2013-7-25 17:44 编辑

以下是我的一段批处理代码,在安装系统首次进入桌面时运行一次:
  1. @ECHO OFF
  2. TITLE RunOnce
  3. MODE CON: COLS=50 LINES=12
  4. ECHO=RunOnce.CMD 操作开始,请耐心等待新的操作提示。
  5. for /f "skip=2 tokens=2 delims==" %%a in ('wmic path Win32_SystemEnclosure get ChassisTypes /value') do set a=%%a
  6. set b=0
  7. if "%a%"=="{3}" set b=2
  8. REG ADD "HKEY_USERS\.DEFAULT\Control Panel\Keyboard" /v "InitialKeyboardIndicators" /d "%b%" /f >NUL 2>NUL
  9. REG ADD "HKEY_CURRENT_USER\Control Panel\Keyboard" /v "InitialKeyboardIndicators" /d "%b%" /f >NUL 2>NUL
  10. if "%b%"=="2" (
  11. echo>%temp%\NumLock.vbs On Error Resume Next
  12. echo>>%temp%\NumLock.vbs set WshShell=CreateObject("WScript.shell"^)
  13. echo>>%temp%\NumLock.vbs WshShell.SendKeys"{NUMLOCK}"
  14. echo>>%temp%\NumLock.vbs CreateObject("Scripting.FileSystemObject"^).DeleteFile WSH.ScriptFullName, True
  15. START "" "%temp%\NumLock.vbs" >NUL 2>NUL
  16. )
  17. net accounts /maxpwage:unlimited >nul 2>nul
  18. if exist "%SYSTEMROOT%\SYSTEM32\QQPhotoDrawEx.dll" regsvr32 /s "%SYSTEMROOT%\SYSTEM32\QQPhotoDrawEx.dll" >NUL 2>NUL
  19. if exist "%SYSTEMROOT%\SYSTEM32\QQQunPhotoDrawEx.dll" regsvr32 /s "%SYSTEMROOT%\SYSTEM32\QQQunPhotoDrawEx.dll" >NUL 2>NUL
  20. if exist "%SYSTEMROOT%\SYSTEM32\QQPhotoDrawProxy.dll" regsvr32 /s "%SYSTEMROOT%\SYSTEM32\QQPhotoDrawProxy.dll" >NUL 2>NUL
  21. if exist "%SYSTEMROOT%\SYSTEM32\npQQPhotoDrawEx.dll" regsvr32 /s "%SYSTEMROOT%\SYSTEM32\npQQPhotoDrawEx.dll" >NUL 2>NUL
  22. if exist "%SYSTEMROOT%\SYSTEM32\TXFTNActiveX.dll" regsvr32 /s "%SYSTEMROOT%\SYSTEM32\TXFTNActiveX.dll" >NUL 2>NUL
  23. SC config WSCSVC start= AUTO >nul 2>nul
  24. SC config WebClient start= DISABLED >nul 2>nul
  25. SC config Stisvc start= AUTO >nul 2>nul
  26. SC config SRSERVICE start= DISABLED >nul 2>nul
  27. SC config seclogon start= DISABLED >nul 2>nul
  28. SC config RemoteRegistry start= DISABLED >nul 2>nul
  29. SC config ImapiService start= AUTO >nul 2>nul
  30. SC config HELPSVC start= DISABLED >nul 2>nul
  31. SC config ERSVC start= DISABLED >nul 2>nul
  32. SC config BITS start= AUTO >nul 2>nul
  33. if exist %systemroot%\system32\ipseccmd.exe ipseccmd  -w REG -p "HFUT_SECU" -r "Block TCP/135" -f *+0:135:TCP -n BLOCK -x >nul 2>nul
  34. if exist %systemroot%\system32\ipseccmd.exe ipseccmd  -w REG -p "HFUT_SECU" -r "Block UDP/135" -f *+0:135:UDP -n BLOCK -x >nul 2>nul
  35. RunDll32 setupapi.dll,InstallHinfSection DefaultInstall 128 WINDOWSXP-KB2779562-X86-CHS.INF >NUL 2>NUL
  36. DEL/Q/F %systemroot%\INF\WINDOWSXP-KB2779562-X86-CHS.INF
  37. DEL/Q/F %systemroot%\INF\WINDOWSXP-KB2779562-X86-CHS.PNF
  38. RunDLL32 shell32.dll,Control_RunDLL %SystemRoot%\system32\TIMEDATE.cpl,,/Z China Standard Time
  39. %systemroot%\SYSTEM32\MsnMsgs.MSI /q
  40. DEL/Q/F %systemroot%\SYSTEM32\MsnMsgs.MSI
  41. sc stop AlipaySecSvc >nul 2>nul
  42. sc config AlipaySecSvc start= DEMAND >nul 2>nul
  43. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\Compression" /V "DefFolder" /D "" /F >NUL 2>NUL
  44. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\Extraction" /V "DefFolder" /D "" /F >NUL 2>NUL
  45. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\Extraction" /V "AppendName" /T "REG_DWORD" /D "1" /F >NUL 2>NUL
  46. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\Extraction" /V "RemoveRedundantFolder" /T "REG_DWORD" /D "0" /F >NUL 2>NUL
  47. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\Extraction" /V "UseExclNames" /T "REG_DWORD" /D "0" /F >NUL 2>NUL
  48. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\General" /V "Priority" /T "REG_DWORD" /D "0" /F >NUL 2>NUL
  49. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\General" /V "SMP" /T "REG_DWORD" /D "1" /F >NUL 2>NUL
  50. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\General" /V "History" /T "REG_DWORD" /D "0" /F >NUL 2>NUL
  51. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\General" /V "DlgHistory" /T "REG_DWORD" /D "0" /F >NUL 2>NUL
  52. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\General" /V "WizardMode" /T "REG_DWORD" /D "0" /F >NUL 2>NUL
  53. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\General" /V "ShowComment" /T "REG_DWORD" /D "1" /F >NUL 2>NUL
  54. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\General" /V "Log" /T "REG_DWORD" /D "0" /F >NUL 2>NUL
  55. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\General" /V "ReuseWindow" /T "REG_DWORD" /D "0" /F >NUL 2>NUL
  56. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\General" /V "Sound" /T "REG_DWORD" /D "0" /F >NUL 2>NUL
  57. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\General" /V "RestoreFolder" /T "REG_DWORD" /D "0" /F >NUL 2>NUL
  58. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\General" /V "WipeTemp" /T "REG_DWORD" /D "0" /F >NUL 2>NUL
  59. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\General\Toolbar" /V "ViewMain" /T "REG_DWORD" /D "1" /F >NUL 2>NUL
  60. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\General\Toolbar" /V "ViewSmall" /T "REG_DWORD" /D "1" /F >NUL 2>NUL
  61. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\General\Toolbar" /V "LargeButtons" /T "REG_DWORD" /D "1" /F >NUL 2>NUL
  62. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\General\Toolbar" /V "ButtonsText" /T "REG_DWORD" /D "1" /F >NUL 2>NUL
  63. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\Interface" /V "SystemProgressBar" /T "REG_DWORD" /D "1" /F >NUL 2>NUL
  64. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\Interface" /V "TaskbarProgressBar" /T "REG_DWORD" /D "0" /F >NUL 2>NUL
  65. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\FileList" /V "ShowSeconds" /T "REG_DWORD" /D "1" /F >NUL 2>NUL
  66. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\Paths" /V "TempRemovableOnly" /T "REG_DWORD" /D "1" /F >NUL 2>NUL
  67. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\Paths" /V "StartFolder" /D "" /F >NUL 2>NUL
  68. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\Viewer" /V "Type" /T "REG_DWORD" /D "2" /F >NUL 2>NUL
  69. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\Viewer" /V "DosCharSet" /T "REG_DWORD" /D "0" /F >NUL 2>NUL
  70. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\Viewer" /V "ReuseWindow" /T "REG_DWORD" /D "0" /F >NUL 2>NUL
  71. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\Viewer" /V "Wrap" /T "REG_DWORD" /D "1" /F >NUL 2>NUL
  72. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\Viewer" /V "ExternalViewer" /D "" /F >NUL 2>NUL
  73. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\Setup" /V "CascadedMenu" /T "REG_DWORD" /D "1" /F >NUL 2>NUL
  74. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\Setup\.RAR" /V "Set" /T "REG_DWORD" /D "1" /F >NUL 2>NUL
  75. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\Setup\.TAR" /V "Set" /T "REG_DWORD" /D "1" /F >NUL 2>NUL
  76. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\Setup\.ZIP" /V "Set" /T "REG_DWORD" /D "1" /F >NUL 2>NUL
  77. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\Setup\.GZip" /V "Set" /T "REG_DWORD" /D "1" /F >NUL 2>NUL
  78. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\Setup\.CAB" /V "Set" /T "REG_DWORD" /D "1" /F >NUL 2>NUL
  79. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\Setup\.UUE" /V "Set" /T "REG_DWORD" /D "1" /F >NUL 2>NUL
  80. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\Setup\.ARJ" /V "Set" /T "REG_DWORD" /D "1" /F >NUL 2>NUL
  81. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\Setup\.BZ2" /V "Set" /T "REG_DWORD" /D "1" /F >NUL 2>NUL
  82. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\Setup\.LZH" /V "Set" /T "REG_DWORD" /D "1" /F >NUL 2>NUL
  83. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\Setup\.JAR" /V "Set" /T "REG_DWORD" /D "1" /F >NUL 2>NUL
  84. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\Setup\.ACE" /V "Set" /T "REG_DWORD" /D "1" /F >NUL 2>NUL
  85. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\Setup\.ISO" /V "Set" /T "REG_DWORD" /D "1" /F >NUL 2>NUL
  86. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\Setup\.7-Zip" /V "Set" /T "REG_DWORD" /D "1" /F >NUL 2>NUL
  87. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\Setup\.Z" /V "Set" /T "REG_DWORD" /D "1" /F >NUL 2>NUL
  88. REG ADD "HKEY_CURRENT_USER\Software\WinRAR\VirusScan" /V "Prompt" /T "REG_DWORD" /D "1" /F >NUL 2>NUL
  89. REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.zip" /VE /D "WinRAR.ZIP" /F >NUL 2>NUL
  90. reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\4080110900063D11C8EF10054038389C\Patches\8A1D993794709E340B8060D603DF29F8" /v "MSI3" /t "REG_DWORD" /d "1" /f >nul 2>nul
  91. reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\4080110900063D11C8EF10054038389C\Patches\8A1D993794709E340B8060D603DF29F8" /v "State" /t "REG_DWORD" /d "1" /f >nul 2>nul
  92. reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\4080110900063D11C8EF10054038389C\Patches\8A1D993794709E340B8060D603DF29F8" /v "Uninstallable" /t "REG_DWORD" /d "0" /f >nul 2>nul
  93. reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\4080110900063D11C8EF10054038389C\Patches\8A1D993794709E340B8060D603DF29F8" /v "LUAEnabled" /t "REG_DWORD" /d "0" /f >nul 2>nul
  94. reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\4080110900063D11C8EF10054038389C\Patches\8A1D993794709E340B8060D603DF29F8" /v "PatchType" /t "REG_DWORD" /d "0" /f >nul 2>nul
  95. reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\4080110900063D11C8EF10054038389C\Patches\8A1D993794709E340B8060D603DF29F8" /v "Installed" /d "%date:~0,4%%date:~5,2%%date:~8,2%" /f >nul 2>nul
  96. reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\4080110900063D11C8EF10054038389C\Patches\8A1D993794709E340B8060D603DF29F8" /v "DisplayName" /d "Update for Outlook 2003 Junk E-mail Filter (KB2760754): OUTLFLTR" /f >nul 2>nul
  97. reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\4080110900063D11C8EF10054038389C\Patches\8A1D993794709E340B8060D603DF29F8" /v "MoreInfoURL" /d "http://support.microsoft.com/kb/2760754" >nul 2>nul
  98. REG DELETE "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Default HTML Editor\shell\edit\command" /F >NUL 2>NUL
  99. REG DELETE "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Default HTML Editor\shell\edit\command" /F >NUL 2>NUL
  100. REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Default HTML Editor" /V "Description" /D "记事本" /F >NUL 2>NUL
  101. REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Default HTML Editor\shell\edit\command" /VE /T "REG_EXPAND_SZ" /D "%%SystemRoot%%\system32\NOTEPAD.EXE %%1" /F >NUL 2>NUL
  102. REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Shared\HTML\Default Editor\shell\edit\command" /VE /T "REG_EXPAND_SZ" /D "%%SystemRoot%%\system32\NOTEPAD.EXE %%1" /F >NUL 2>NUL
  103. REG ADD "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Default HTML Editor" /V "Description" /D "记事本" /F >NUL 2>NUL
  104. REG ADD "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Default HTML Editor\shell\edit\command" /VE /T "REG_EXPAND_SZ" /D "%%SystemRoot%%\system32\NOTEPAD.EXE %%1" /F >NUL 2>NUL
  105. REG ADD "HKEY_LOCAL_MACHINE\Software\Microsoft\Shared\HTML\Default Editor\shell\edit\command" /VE /T "REG_EXPAND_SZ" /D "%%SystemRoot%%\system32\NOTEPAD.EXE %%1" /F >NUL 2>NUL
  106. REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_MAXCONNECTIONSPERSERVER" /v "iexplore.exe" /t "REG_DWORD" /d "64" /f >NUL 2>NUL
  107. REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\MAXCONNECTIONSPER1_0SERVER" /v "iexplore.exe" /t "REG_DWORD" /d "64" /f >NUL 2>NUL
  108. REG ADD "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_MAXCONNECTIONSPERSERVER" /v "iexplore.exe" /t "REG_DWORD" /d "64" /f >NUL 2>NUL
  109. REG ADD "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\Main\FeatureControl\MAXCONNECTIONSPER1_0SERVER" /v "iexplore.exe" /t "REG_DWORD" /d "64" /f >NUL 2>NUL
  110. IF EXIST "%systemroot%\Web\Wallpaper\Wallpaper*.jpg" DEL/F/Q "%systemroot%\Web\Wallpaper\Wallpaper*.jpg" >NUL 2>NUL
  111. DEL/F/Q/S/A "%SYSTEMDRIVE%\Documents and Settings\DD_*.TXT" >nul 2>nul
  112. DEL/F/Q/S/A "%SYSTEMDRIVE%\Documents and Settings\AUCHECK_PARSER.TXT" >nul 2>nul
  113. DEL/F/Q/S/A "%SYSTEMDRIVE%\Documents and Settings\DD_*.TXT" >nul 2>nul
  114. DEL/F/Q/S/A "%SYSTEMDRIVE%\Documents and Settings\AUCHECK_PARSER.TXT" >nul 2>nul
  115. DEL/F/Q/S/A "%SYSTEMDRIVE%\Documents and Settings\DD_*.TXT" >nul 2>nul
  116. DEL/F/Q/S/A "%SYSTEMDRIVE%\Documents and Settings\AUCHECK_PARSER.TXT" >nul 2>nul
  117. IF EXIST "%SYSTEMDRIVE%\FTNSTAT.*" DEL/F/Q "%SYSTEMDRIVE%\FTNSTAT.*" >NUL 2>NUL
  118. if exist "%systemroot%\FONTMP\fontinst.exe" "%systemroot%\FONTMP\fontinst.exe"
  119. IF EXIST "%systemroot%\FONTMP\" RD/Q/S "%systemroot%\FONTMP" >nul 2>nul
  120. WMPNetwk.exe
  121. powercfg.exe /h off >NUL 2>NUL
  122. chkntfs /t:0 >NUL 2>NUL
  123. IF EXIST %SYSTEMROOT%\SYSTEM32\OEMINFO.INI ATTRIB %SYSTEMROOT%\SYSTEM32\OEMINFO.INI +A +H +R +S >NUL 2>NUL
  124. IF EXIST %SYSTEMROOT%\SYSTEM32\OEMLOGO.BMP ATTRIB %SYSTEMROOT%\SYSTEM32\OEMLOGO.BMP +A +H +R +S >NUL 2>NUL
  125. REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "AutoAdminLogon" /d "0" /f >nul 2>nul
  126. REG DELETE "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "DefaultPassword" /f >nul 2>nul
  127. REG DELETE "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\SearchScopes\{502244CB-1653-4B8D-834A-4616388689CE}" /f >NUL 2>NUL
  128. DEL/F/Q/S/A "%SYSTEMDRIVE%\Documents and Settings\邮件接收者.MAPIMail" >NUL 2>NUL
  129. DEL/F/Q/S/A "%SYSTEMDRIVE%\Documents and Settings\压缩(zipped)文件夹.ZFSendToTarget" >NUL 2>NUL
  130. IF EXIST "%ALLUSERSPROFILE%\「开始」菜单\设定程序访问和默认值.*" DEL /F /Q /A "%ALLUSERSPROFILE%\「开始」菜单\设定程序访问和默认值.*" >NUL 2>NUL
  131. IF EXIST "%ALLUSERSPROFILE%\「开始」菜单\Windows Update.*" IF EXIST "%ALLUSERSPROFILE%\「开始」菜单\Microsoft Update.*" DEL /F /Q /A "%ALLUSERSPROFILE%\「开始」菜单\Windows Update.*" >NUL 2>NUL
  132. IF EXIST "%USERPROFILE%\「开始」菜单\Microsoft Update.lnk" IF EXIST "%ALLUSERSPROFILE%\「开始」菜单\Microsoft Update.lnk" DEL /F /Q /A "%USERPROFILE%\「开始」菜单\Microsoft Update.lnk" >NUL 2>NUL
  133. IF EXIST "%SYSTEMDRIVE%\Documents and Settings\IS*.TMP" (
  134.   FOR /F "DELIMS=" %%I IN ('DIR/B/S/AD "%SYSTEMDRIVE%\Documents and Settings\IS*.TMP"') DO (
  135.     IF EXIST "%%I\" RD/Q/S "%%I"
  136.   )
  137. ) >NUL 2>NUL
  138. IF EXIST "%SYSTEMDRIVE%\PerfLog\" RD/Q/S "%SYSTEMDRIVE%\PerfLog" >NUL 2>NUL
  139. DEL/F/S/Q/A %SYSTEMROOT%\setuperr.log >NUL 2>NUL
  140. DEL/F/S/Q/A %SYSTEMROOT%\WGAErrLog.log >NUL 2>NUL
  141. REG DELETE "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v "IMJPMIG8.1" /f >NUL 2>NUL
  142. REG DELETE "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v "PHIME2002ASync" /f >NUL 2>NUL
  143. REG DELETE "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v "PHIME2002A" /f >NUL 2>NUL
  144. REG DELETE "HKEY_CURRENT_USER\Keyboard Layout\Preload" /va /f >NUL 2>NUL
  145. REG DELETE "HKEY_USERS\.DEFAULT\Keyboard Layout\Preload" /va /f >NUL 2>NUL
  146. REG ADD "HKEY_CURRENT_USER\Keyboard Layout\Preload" /v "1" /d "00000804" /f >NUL 2>NUL
  147. REG ADD "HKEY_USERS\.DEFAULT\Keyboard Layout\Preload" /v "1" /d "00000804" /f >NUL 2>NUL
  148. REG ADD "HKEY_CURRENT_USER\Keyboard Layout\Preload" /v "2" /d "E0200804" /f >NUL 2>NUL
  149. REG ADD "HKEY_USERS\.DEFAULT\Keyboard Layout\Preload" /v "2" /d "E0200804" /f >NUL 2>NUL
  150. REG ADD "HKEY_CURRENT_USER\Keyboard Layout\Preload" /v "3" /d "E0210804" /f >NUL 2>NUL
  151. REG ADD "HKEY_USERS\.DEFAULT\Keyboard Layout\Preload" /v "3" /d "E0210804" /f >NUL 2>NUL
  152. REG ADD "HKEY_CURRENT_USER\Keyboard Layout\Preload" /v "4" /d "E00E0804" /f >NUL 2>NUL
  153. REG ADD "HKEY_USERS\.DEFAULT\Keyboard Layout\Preload" /v "4" /d "E00E0804" /f >NUL 2>NUL
  154. reg export HKEY_CLASSES_ROOT\HCP %SYSTEMROOT%\hcp_backup.reg >NUL 2>NUL
  155. reg delete HKEY_CLASSES_ROOT\HCP /f >NUL 2>NUL
  156. FOR %%I IN (C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO (
  157. net stop Browser >NUL 2>NUL
  158. net stop Server >NUL 2>NUL
  159. reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters" /v "AutoShareWks" /t "REG_DWORD" /d "0" /f >NUL 2>NUL
  160. net share admin$ /delete >NUL 2>NUL
  161. reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v "restrictanonymous" /t "REG_DWORD" /d "1" /f >NUL 2>NUL
  162. net share ipc$ /delete >NUL 2>NUL
  163. reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters" /v "AutoShareServer" /t "REG_DWORD" /d "0" /f >NUL 2>NUL
  164. net share %%I$ /delete >NUL 2>NUL
  165. net start Server >NUL 2>NUL
  166. net start Browser >NUL 2>NUL
  167. )
  168. IF EXIST "%SYSTEMROOT%\DRVLOAD.EXE" (
  169. ECHO>"%ALLUSERSPROFILE%\「开始」菜单\程序\启动\CLDRV.CMD" @ECHO OFF
  170. ECHO>>"%ALLUSERSPROFILE%\「开始」菜单\程序\启动\CLDRV.CMD" IF EXIST %%SYSTEMROOT%%\SYSTEM32\cwnd.exe cwnd /HIDE @
  171. ECHO>>"%ALLUSERSPROFILE%\「开始」菜单\程序\启动\CLDRV.CMD" TITLE 驱动包清理程序
  172. ECHO>>"%ALLUSERSPROFILE%\「开始」菜单\程序\启动\CLDRV.CMD" IF EXIST %%SYSTEMROOT%%\*DRVLOAD* DEL/F/Q/S/A %%SYSTEMROOT%%\*DRVLOAD* ^>NUL 2^>NUL
  173. ECHO>>"%ALLUSERSPROFILE%\「开始」菜单\程序\启动\CLDRV.CMD" IF EXIST "%%SYSTEMDRIVE%%\Sysprep\" RD/Q/S "%%SYSTEMDRIVE%%\Sysprep" ^>NUL 2^>NUL
  174. ECHO>>"%ALLUSERSPROFILE%\「开始」菜单\程序\启动\CLDRV.CMD" DEL %%0
  175. )
  176. REG DELETE "HKEY_LOCAL_MACHINE\SOFTWARE\Easy DriverPacks" /F >NUL 2>NUL
  177. REG DELETE "HKEY_LOCAL_MACHINE\SOFTWARE\WanDrv" /F >NUL 2>NUL
  178. DEL/F/Q/S/A %SYSTEMROOT%\*.ed5log >NUL 2>NUL
  179. FOR /F "DELIMS=" %%I IN ('DIR/A/B/S "D:\Personal\「开始」菜单\*Internet Explorer*"') DO IF EXIST "%%I" ATTRIB /D /S "%%I" +R +S >NUL 2>NUL
  180. FOR /F "DELIMS=" %%I IN ('DIR/A/B/S "%systemdrive%\Documents and Settings\*Internet Explorer*"') DO IF EXIST "%%I" ATTRIB /D /S "%%I" +R +S >NUL 2>NUL
  181. REG DELETE "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\Components\0" /F >NUL 2>NUL
  182. IF EXIST "%userprofile%\Favorites\Microsoft 网站\" (
  183.   RD/Q/S "%userprofile%\Favorites\Microsoft 网站" >nul 2>nul
  184.   REM.>"%userprofile%\Favorites\Microsoft 网站"
  185.   ATTRIB /D /S "%userprofile%\Favorites\Microsoft 网站" +A +H +R +S >nul 2>nul
  186. ) ELSE (
  187.   DEL/F/Q/A "%userprofile%\Favorites\Microsoft 网站" >nul 2>nul
  188.   REM.>"%userprofile%\Favorites\Microsoft 网站"
  189.   ATTRIB /D /S "%userprofile%\Favorites\Microsoft 网站" +A +H +R +S >nul 2>nul
  190. )
  191. IF EXIST "%userprofile%\Favorites\链接\" (
  192.   RD/Q/S "%userprofile%\Favorites\链接" >nul 2>nul
  193.   REM.>"%userprofile%\Favorites\链接"
  194.   ATTRIB /D /S "%userprofile%\Favorites\链接" +A +H +R +S >nul 2>nul
  195. ) ELSE (
  196.   DEL/F/Q/A "%userprofile%\Favorites\链接" >nul 2>nul
  197.   REM.>"%userprofile%\Favorites\链接"
  198.   ATTRIB /D /S "%userprofile%\Favorites\链接" +A +H +R +S >nul 2>nul
  199. )
  200. IF EXIST "%userprofile%\Favorites\收藏夹栏\" (
  201.   RD/Q/S "%userprofile%\Favorites\收藏夹栏" >nul 2>nul
  202.   REM.>"%userprofile%\Favorites\收藏夹栏"
  203.   ATTRIB /D /S "%userprofile%\Favorites\收藏夹栏" +A +H +R +S >nul 2>nul
  204. ) ELSE (
  205.   DEL/F/Q/A "%userprofile%\Favorites\收藏夹栏" >nul 2>nul
  206.   REM.>"%userprofile%\Favorites\收藏夹栏"
  207.   ATTRIB /D /S "%userprofile%\Favorites\收藏夹栏" +A +H +R +S >nul 2>nul
  208. )
  209. IF EXIST %SYSTEMROOT%\EXHOTFIX.CMD REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce" /v "OFFICE2007补充补丁包" /d "%systemroot%\EXHOTFIX.CMD" >NUL 2>NUL
  210. IF EXIST "%SYSTEMROOT%\*KB2757638*.EXE" FOR /F "DELIMS=" %%I IN ('DIR/B/O "%SYSTEMROOT%\*KB2757638*.EXE"') DO IF EXIST "%SYSTEMDRIVE%\SOFTWARES\*THUNDER*.EXE" MOVE /Y "%SYSTEMROOT%\%%I" %SYSTEMDRIVE%\SOFTWARES\
  211. IF EXIST "%SYSTEMROOT%\*KB951830*.EXE" FOR /F "DELIMS=" %%I IN ('DIR/B/O "%SYSTEMROOT%\*KB951830*.EXE"') DO (
  212.   FOR /F %%i IN ('ipconfig /all ^| find /c /i "Ethernet Adapter"') DO IF "%%i" GEQ "3" "%SYSTEMROOT%\%%I" /q /n /z >NUL 2>NUL
  213.   DEL/F/Q/A "%SYSTEMROOT%\%%I" >NUL 2>NUL
  214. )
  215. IF EXIST "%SYSTEMROOT%\WINDOWS*KB*.EXE" FOR /F "DELIMS=" %%I IN ('DIR/B/O:D "%SYSTEMROOT%\WINDOWS*KB*.EXE"') DO (
  216. "%SYSTEMROOT%\%%I" /q /n /z >NUL 2>NUL
  217. )
  218. ping 127.0.0.1 -n 3 >NUL 2>NUL
  219. DEL/F/Q/A "%SYSTEMROOT%\WINDOWS*KB*.EXE" >NUL 2>NUL
  220. FOR %%I IN (C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO (
  221. IF EXIST "%%I:\HotFix\WINDOWS*KB*.EXE" FOR /F "DELIMS=" %%W IN ('DIR/B/O:D "%%I:\HotFix\WINDOWS*KB*.EXE"') DO (
  222. "%%I:\HotFix\%%W" /q /n /z >NUL 2>NUL
  223. )
  224. )
  225. FOR %%I IN (C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO (
  226. IF EXIST "%%I:\HotFix\OFFICE*KB*.EXE" FOR /F "DELIMS=" %%O IN ('DIR/B/O:D "%%I:\HotFix\OFFICE*KB*.EXE"') DO (
  227. "%%I:\HotFix\%%O" /Q:A /R:N >NUL 2>NUL
  228. )
  229. )
  230. REG DELETE "HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\RunOnce" /V "GUISETUP" /F >NUL 2>NUL
  231. REG DELETE "HKEY_USERS\S-1-5-18\Software\Microsoft\Windows\CurrentVersion\RunOnce" /V "GUISETUP" /F >NUL 2>NUL
  232. REG DELETE "HKEY_USERS\S-1-5-19\Software\Microsoft\Windows\CurrentVersion\RunOnce" /V "GUISETUP" /F >NUL 2>NUL
  233. REG DELETE "HKEY_USERS\S-1-5-20\Software\Microsoft\Windows\CurrentVersion\RunOnce" /V "GUISETUP" /F >NUL 2>NUL
  234. IF EXIST %SYSTEMDRIVE%\*.LOG DEL/F/Q/A %SYSTEMDRIVE%\*.LOG >NUL 2>NUL
  235. IF EXIST "%TEMP%\Office2003.log" DEL/F/Q/A "%TEMP%\Office2003.log" >NUL 2>NUL
  236. DEL/F/Q/S/A "%systemdrive%\Documents and Settings\*.idx" >NUL 2>NUL
  237. DEL/F/Q/S/A "%systemdrive%\Documents and Settings\*.tpt" >NUL 2>NUL
  238. DEL/F/Q/A "%SYSTEMROOT%\Tasks\*.job" >NUL 2>NUL
  239. IF EXIST "%ProgramFiles%\PcTools\SystemTools\AutoDisplay.exe" START/WAIT "" "%ProgramFiles%\PcTools\SystemTools\AutoDisplay.exe" /wait -10
  240. FOR /F %%I IN ('ipconfig /all ^| find /c /i "Ethernet Adapter"') DO (
  241. IF NOT "%%I"=="0" IF EXIST "%ProgramFiles%\PcTools\SystemTools\NetCfg.exe" START/WAIT "" "%ProgramFiles%\PcTools\SystemTools\NetCfg.exe"
  242. )
  243. IF NOT EXIST "%SYSTEMDRIVE%\SOFTWARES\软件管理器.CMD" msg %username% /time:1 "RunOnce.CMD 操作结束,部分优化项目重启后生效。"
  244. IF EXIST "%SYSTEMDRIVE%\SOFTWARES\" IF NOT EXIST %SYSTEMDRIVE%\SOFTWARES\*.EXE IF NOT EXIST %SYSTEMDRIVE%\SOFTWARES\*.MSI IF NOT EXIST %SYSTEMDRIVE%\SOFTWARES\*.BAT IF NOT EXIST %SYSTEMDRIVE%\SOFTWARES\*.CMD RD/Q/S "%SYSTEMDRIVE%\SOFTWARES" >NUL 2>NUL
  245. IF EXIST "%SYSTEMDRIVE%\SOFTWARES\软件管理器.CMD" START "" CMD /C "%SYSTEMDRIVE%\SOFTWARES\软件管理器.CMD"
  246. wmic nteventlog get filename
  247. wmic nteventlog where filename="AppEvent" call cleareventlog
  248. wmic nteventlog where filename="SecEvent" call cleareventlog
  249. wmic nteventlog where filename="SysEvent" call cleareventlog
  250. DEL %0
复制代码
经过在虚拟机测试,当只有一个系统盘以及一个光驱盘符的时候,运行该批处理会出现一次“系统找不到指定的路径。”错误提示。当系统存在C、D两个固定驱动器的时候却不会出现上述错误提示。请问有谁知道我的批处理代码错在哪里吗?

终于知道错误在哪里了
  1. FOR /F "DELIMS=" %%I IN ('DIR/A/B/S "D:\Personal\「开始」菜单\*Internet Explorer*"') DO IF EXIST "%%I" ATTRIB /D /S "%%I" +R +S >NUL 2>NUL
复制代码
我本来以为有 IF EXIST "%%I"就不会出错,结果发现原来没有“D:\”也会出错。

现在改为
  1. IF EXIST "D:\Personal\" FOR /F "DELIMS=" %%I IN ('DIR/A/B/S "D:\Personal\「开始」菜单\*Internet Explorer*"') DO IF EXIST "%%I" ATTRIB /D /S "%%I" +R +S >NUL 2>NUL
复制代码
问题解决了

貌似是是一个优化系统的BAT

TOP

回复 3# crist


    能。
我帮忙写的代码不需要付钱。如果一定要给,请在微信群或QQ群发给大家吧。
【微信公众号、微信群、QQ群】http://bbs.bathome.net/thread-3473-1-1.html
【支持批处理之家,加入VIP会员!】http://bbs.bathome.net/thread-67716-1-1.html

TOP

回复 2# Batcher


    代码这么多,就算回显on了,能看出具体是哪行吗?

TOP

把第一行删掉
把最后一行改成:
pause

执行一遍看看是第几行在报错
我帮忙写的代码不需要付钱。如果一定要给,请在微信群或QQ群发给大家吧。
【微信公众号、微信群、QQ群】http://bbs.bathome.net/thread-3473-1-1.html
【支持批处理之家,加入VIP会员!】http://bbs.bathome.net/thread-67716-1-1.html

TOP

返回列表