windows xp下没有dos的choice命令的解决方法
dos6.0下能实现的choice选项,但是因为choice是外部命令,在xp中没有choice.exe所以不能实现选择菜单。解决办法:用SET命令代替
dos6.0下能实现的choice选项,但是因为choice是外部命令,在xp中没有choice.exe所以不能实现选择菜单。解决办法:用SET命令代替
set 命令详解
在批处理中回显信息有两个命令,echo和set /p=<nul,它们的共同点在于都是对程序执行信
息的屏幕输出,区别在于echo是换行输出,而set /p=<nul是不换行追回输出,这样说大家可能
不是很理解,下面给出两个代码来进行比较:
代码:
1 2 3 4 | @ echo off echo bathome echo batman pause>nul |
代码:
1 2 3 4 | @ echo off set /p=bathome<nul set /p=batman<nul pause>nul |
运行这两段代码,大家看到第一段的结果是分两行依次在屏幕上输出了bathome
和batman,而第二段的结果是在一行中依次输出了bathome和batman,大家再仔细点还可看到光
标所处的位置也不一样。好了,就讲到这里吧。
一、set的主要作用是赋值
1、set /p a=promptstring
先显示promptstring,再接受用户输入的内容,以回车表示结束,赋值给变量a
2、set /p a=promptstring<1.txt
先显示promptstring,再把"<"管道号右边的1.txt文件中从第一个字符开始直到碰到回车符的内容赋值给变量a (通常表现为第一行)。
3、set /p a=promptstring<nul
先显示promptstring,再把"<"管道号右边nul中内容赋值给变量a ,不用用户按回车就结束语句。因nul是空设备,故没有内容可赋值,变量a仍属未定义。
二、因为在接受用户输入前可先显示promptstring,故此set还可当作显示命令用(仅作为显示命令使用时,可省略变量a)
1、set /p =promptstring
显示promptstring,再接受用户输入的内容,以回车表示结束。如用户直接按回车则仅显示promptstring。(赋值给空变量,赋值意义已丧失,仅作显示之用,需用户按回车键结束语句,无多大实际用途)
2、set /p =promptstring<1.txt
先显示promptstring,再把"<"管道号右边的1.txt文件中从第一个字符开始直到碰到回车符的内容赋值给空变量(无实际用途)
3、set /p =promptstring<nul
先显示promptstring,再把"<"管道号右边nul中内容赋值给空变量,不用用户按回车就结束语句,实际中常用这个句式作为显示语句。因显示promptstring后光标不换行,故实际中这个句式用到很多。如2楼所述,还有光标退格等。
以下是补充:
显示、设置或删除 cmd.exe 环境变量。
SET [variable=[string]]
variable 指定环境变量名。
string 指定要指派给变量的一系列字符串。
要显示当前环境变量,键入不带参数的 SET。
如果命令扩展被启用,SET 会如下改变:
可仅用一个变量激活 SET 命令,等号或值不显示所有前缀匹配SET 命令已使用的名称的所有变量的值。
例: SET P
会显示所有以字母 P 打头的变量
如果在当前环境中找不到该变量名称,SET 命令将把 ERRORLEVEL设置成 1。
SET 命令不允许变量名含有等号。
在 SET 命令中添加了两个新命令行开关:
SET /A
SET /P variable=[promptString]
/A 命令行开关指定等号右边的字符串为被评估的数字表达式。
除十六进制有 0x 前缀,八进制有 0 前缀的,数字值为十进位数字。因此,0x12 与 18 和 022 相同。请注意八进制公式可能很容易搞混: 08 和 09 是无效的数字,因为 8 和 9 不是有效的八进制位数。
/P 命令行开关允许将变量数值设成用户输入的一行输入。读取输入行之前,显示指定的 promptString。promptString 可以是空的。
%PATH:~10,5%
会扩展 PATH 环境变量,然后只使用在扩展结果中从第 11 个(偏移量 10)字符开始的五个字符。如果没有指定长度,则采用默认值,即变量数值的余数。如果两个数字(偏移量和长度)都是负数,使用的数字则是环境变量数值长度加上指定的偏移量或长度。
%PATH:~-10%
会提取 PATH 变量的最后十个字符。
%PATH:~0,-2%
会提取 PATH 变量的所有字符,除了最后两个。
如果命令扩展被启用,有几个动态环境变量可以被扩展,但不会出现在 SET 显示的变量列表中。每次变量数值被扩展时,这些变量数值都会被动态计算。如果用户用这些名称中任何一个定义变量,那个定义会替代下面描述的动态定义:
í% - 扩展到当前目录字符串。
úTE% - 用跟 DATE 命令同样的格式扩展到当前日期。
%TIME% - 用跟 TIME 命令同样的格式扩展到当前时间。
%RANDOM% - 扩展到 0 和 32767 之间的任意十进制数字。
%ERRORLEVEL% - 扩展到当前 ERRORLEVEL 数值。
%CMDEXTVERSION% - 扩展到当前命令处理器扩展版本号。
%CMDCMDLINE% - 扩展到调用命令处理器的原始命令行。
应用例子:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 | @ echo off title Windows Xp 优化文件! :start cls color 0c MODE con: COLS=50 LINES=27 echo Windows Xp 优化文件! echo Powered By ThunderRay! echo . echo ============================== echo 请选择要进行的操作,然后按回车 echo ============================== echo . echo 1.优化系统服务 echo . echo 2.进行端口操作 echo . echo 3.设置IP为192.168.1.2 echo . echo (局域网上网者慎用此功能) echo . echo 4.其它优化 echo . echo 5.设置OEM信息 echo . echo 6.清除根目录下的SXS病毒 echo . echo 7.清理系统垃圾 echo . echo 8.退出 echo . :cho set choice= set /p choice= 请选择: IF NOT "%Choice%" == "" SET Choice=%Choice:~0,1% if /i "%choice%" == "1" goto start2 if /i "%choice%" == "2" goto start3 if /i "%choice%" == "3" goto ip if /i "%choice%" == "4" goto other if /i "%choice%" == "5" goto oem if /i "%choice%" == "6" goto virus if /i "%choice%" == "7" goto del if /i "%choice%" == "8" goto end echo 选择无效,请重新输入 echo . goto cho :start2 cls echo Windows Xp 优化文件! echo Powered By ThunderRay! echo . echo ============================== echo 请选择要进行的操作,然后按回车 echo ============================== echo . echo 1.优化XP系统服务 echo . echo 2.恢复XP原系统服务 echo . echo 3.返回主菜单 echo . echo 4.退出 echo . :Choice2 set choice2= set /p choice2= 请选择: IF NOT "%Choice2%" == "" SET Choice2=%Choice2:~0,1% if /i "%choice2%" == "1" goto optimize if /i "%choice2%" == "2" goto Restore if /i "%choice2%" == "3" goto start if /i "%choice2%" == "4" goto end echo 选择无效,请重新输入 echo . goto Choice2 :optimize cls echo 开始进行优化系统服务... sc config Alerter start= DISABLED sc config ALG start= DISABLED sc config AppMgmt start= DEMAND sc config AudioSrv start= AUTO sc config BITS start= DEMAND sc config Browser start= DISABLED sc config CiSvc start= DISABLED sc config ClipSrv start= DISABLED sc config COMSysApp start= DEMAND sc config CryptSvc start= DEMAND sc config DcomLaunch start= AUTO sc config Dhcp start= DISABLED sc config dmadmin start= DEMAND sc config dmserver start= DISABLED sc config Dnscache start= DISABLED sc config ERSvc start= DISABLED sc config Eventlog start= AUTO sc config EventSystem start= DISABLED sc config FastUserSwitchingCompatibility start= DISABLED sc config helpsvc start= DISABLED sc config HidServ start= DISABLED sc config HTTPFilter start= DEMAND sc config ImapiService start= DISABLED sc config lanmanserver start= DISABLED sc config lanmanworkstation start= AUTO sc config LmHosts start= DISABLED sc config Messenger start= DISABLED sc config mnmsrvc start= DISABLED sc config MSDTC start= DISABLED sc config MSIServer start= DEMAND sc config NetDDE start= DISABLED sc config NetDDEdsdm start= DISABLED sc config Netlogon start= DISABLED sc config Netman start= DEMAND sc config Nla start= DISABLED sc config NtLmSsp start= DISABLED sc config NtmsSvc start= DEMAND sc config Nvsvc start= DISABLED sc config Ose start= DEMAND sc config PlugPlay start= AUTO sc config PolicyAgent start= DISABLED sc config ProtectedStorage start= DISABLED sc config RasAuto start= DEMAND sc config RasMan start= DEMAND sc config RDSessMgr start= DISABLED sc config RemoteAccess start= DISABLED sc config RemoteRegistry start= DISABLED sc config RpcLocator start= DEMAND sc config RpcSs start= AUTO sc config SamSs start= DISABLED sc config SCardSvr start= DISABLED sc config Schedule start= DISABLED sc config seclogon start= DISABLED sc config SENS start= DISABLED sc config SharedAccess start= DISABLED sc config ShellHWDetection start= DISABLED sc config Spooler start= DEMAND sc config srservice start= DISABLED sc config SSDPSRV start= DISABLED sc config Stisvc start= DISABLED sc config Swprv start= DISABLED sc config SysmonLog start= DISABLED sc config TapiSrv start= DEMAND sc config TermService start= DISABLED sc config Themes start= AUTO sc config TlntSvr start= DISABLED sc config TrkWks start= DISABLED sc config UMWdf start= DISABLED sc config upnphost start= DEMAND sc config UPS start= DISABLED sc config VSS start= DISABLED sc config W32Time start= DISABLED sc config WebClient start= DISABLED sc config winmgmt start= AUTO sc config WmdmPmSN start= DISABLED sc config Wmi start= DEMAND sc config WmiApSrv start= DISABLED sc config wuauserv start= DISABLED sc config WZCSVC start= DISABLED sc config wscsvc start= DISABLED sc config xmlprov start= DEMAND echo 优化XP系统服务结束,按任意键返回! pause >nul goto start2 :Restore cls echo 开始恢复XP原系统服务... sc config Alerter start= DISABLED sc config ALG start= DEMAND sc config AppMgmt start= DEMAND sc config AudioSrv start= AUTO sc config BITS start= DEMAND sc config Browser start= AUTO sc config CiSvc start= DEMAND sc config ClipSrv start= DISABLED sc config COMSysApp start= DEMAND sc config CryptSvc start= AUTO sc config DcomLaunch start= AUTO sc config Dhcp start= AUTO sc config dmadmin start= DEMAND sc config dmserver start= AUTO sc config Dnscache start= AUTO sc config ERSvc start= AUTO sc config Eventlog start= AUTO sc config EventSystem start= DEMAND sc config FastUserSwitchingCompatibility start= DEMAND sc config helpsvc start= AUTO sc config HidServ start= DISABLED sc config HTTPFilter start= DEMAND sc config ImapiService start= DEMAND sc config lanmanserver start= AUTO sc config lanmanworkstation start= AUTO sc config LmHosts start= AUTO sc config Messenger start= DISABLED sc config mnmsrvc start= DEMAND sc config MSDTC start= DEMAND sc config MSIServer start= DEMAND sc config NetDDE start= DISABLED sc config NetDDEdsdm start= DISABLED sc config Netlogon start= DEMAND sc config Netman start= DEMAND sc config Nla start= DEMAND sc config NtLmSsp start= DEMAND sc config NtmsSvc start= DEMAND sc config PlugPlay start= AUTO sc config PolicyAgent start= AUTO sc config ProtectedStorage start= AUTO sc config RasAuto start= DEMAND sc config RasMan start= DEMAND sc config RDSessMgr start= DEMAND sc config RemoteAccess start= DISABLED sc config RemoteRegistry start= AUTO sc config RpcLocator start= DEMAND sc config RpcSs start= AUTO sc config RSVP start= DEMAND sc config SamSs start= AUTO sc config SCardSvr start= DEMAND sc config Schedule start= AUTO sc config seclogon start= AUTO sc config SENS start= AUTO sc config SharedAccess start= AUTO sc config ShellHWDetection start= AUTO sc config Spooler start= AUTO sc config srservice start= DISABLED sc config SSDPSRV start= DEMAND sc config stisvc start= DEMAND sc config SwPrv start= DEMAND sc config SysmonLog start= DEMAND sc config TapiSrv start= DEMAND sc config TermService start= DEMAND sc config Themes start= AUTO sc config TlntSvr start= DISABLED sc config TrkWks start= AUTO sc config UMWdf start= DEMAND sc config upnphost start= DEMAND sc config UPS start= DEMAND sc config VSS start= DEMAND sc config W32Time start= AUTO sc config WebClient start= AUTO sc config winmgmt start= AUTO sc config WmdmPmSN start= DEMAND sc config Wmi start= DEMAND sc config WmiApSrv start= DEMAND sc config wscsvc start= AUTO sc config wuauserv start= AUTO sc config WZCSVC start= AUTO sc config xmlprov start= DEMAND echo 恢复XP原系统服务结束,按任意键返回! pause >nul goto start2 :start3 cls echo Windows Xp 优化文件! echo Powered By ThunderRay! echo . echo ============================== echo 请选择要进行的操作,然后按回车 echo ============================== echo . echo 1.封杀135,445端口 echo . echo 2.恢复135,445端口 echo . echo 3.返回主菜单 echo . echo 4.退出 echo . :Choice3 set choice3= set /p choice3= 请选择: IF NOT "%Choice3%" == "" SET Choice2=%Choice2:~0,1% if /i "%choice3%" == "1" goto killport if /i "%choice3%" == "2" goto openport if /i "%choice3%" == "3" goto start if /i "%choice3%" == "4" goto end echo 选择无效,请重新输入 echo . goto Choice3 :killport cls echo 开始封杀135,445端口... reg add HKLM\SOFTWARE\Microsoft\Ole /v EnableDCOM /d N /f reg add HKLM\SOFTWARE\Microsoft\Rpc /v "DCOM Protocols" /t REG_MULTI_SZ /d ncacn_spx\0ncacn_nb_nb\0ncacn_nb_ipx\0 /f sc config MSDTC start= DISABLED reg add HKLM\SYSTEM\CurrentControlSet\Services\NetBT\Parameters /v SMBDeviceEnabled /t REG_DWORD /d 0 /f echo 封杀135,445端口结束,按任意键返回! pause >nul goto start3 :openport cls echo 开始恢复135,445端口... reg add HKLM\SOFTWARE\Microsoft\Ole /v EnableDCOM /d Y /f reg add HKLM\SOFTWARE\Microsoft\Rpc /v "DCOM Protocols" /t REG_MULTI_SZ /d ncacn_spx\0ncacn_nb_nb\0ncacn_nb_ipx\0ncacn_ip_tcp\0 /f sc config MSDTC start= AUTO reg add HKLM\SYSTEM\CurrentControlSet\Services\NetBT\Parameters /v SMBDeviceEnabled /t REG_DWORD /d 1 /f echo 恢复135,445端口结束,按任意键返回! pause >nul goto start3 :ip cls echo 开始设置IP地址... netsh interface ip set address name= "本地连接" static 192.168.1.2 255.255.255.0 echo 设置IP地址结束,按任意键返回! pause >nul goto start :other cls echo 开始进行其它优化... taskkill /im TIMPlatform.exe /f del /f /s /q C:\Progra~1\Tencent\QQ\TIMPlatform.exe del /f /s /q D:\Progra~1\Tencent\QQ\TIMPlatform.exe taskkill /im realsched.exe /f del /f /s /q C:\Progra~1\Common~1\Real\Update_OB\realsched.exe @rem 删除运行QQ和Real时启动的多余程序 reg delete HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /va /f reg delete HKCR\Software\Microsoft\Windows\CurrentVersion\Run /va /f reg delete "HKLM\SOFTWARE\Microsoft\Shared Tools\MSConfig\startupreg" /f del "C:\Documents and Settings\All Users\「开始」菜单\程序\启动\*.*" /q /f del "C:\Documents and Settings\Default User\「开始」菜单\程序\启动\*.*" /q /f del "%userprofile%\「开始」菜单\程序\启动\*.*" /q /f @rem 删除多余的启动项 regsvr32 /u /s igfxpph.dll reg delete HKCR\Directory\Background\shellex\ContextMenuHandlers /f reg add HKCR\Directory\Background\shellex\ContextMenuHandlers\new /ve /d {D969A300-E7FF-11d0-A93B-00A0C90F2719} reg delete HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v HotKeysCmds /f reg delete HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v IgfxTray /f @rem 删除桌面多余的右键菜单 sfc /purgecache @rem 消除系统缓存 regsvr32 /u /s zipfldr.dll @rem 取消ZIP文件夹功能 reg add "HKCU\Control Panel\Desktop" /v AutoEndTasks /t REG_DWORD /d 1 /f reg add "HKCU\Control Panel\Desktop" /v HungAppTimeout /d 50 /f reg add "HKCU\Control Panel\Desktop" /v WaitToKillAppTimeout /d 200 /f @rem 加快关机速度 reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\PrefetchParameters" /v EnablePrefetcher /t REG_DWORD /d 1 /f @rem 启动条滚动一次 reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer /v AlwaysUnloadDLL /t REG_DWORD /d 1 /f @rem 清除内存中不被使用的DLL文件 reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug" /v Auto /d 0 /f @rem 关闭华医生 reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v SFCDisable /t REG_DWORD /d 4294967197 /f @rem 禁用文件保护 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v MaxConnectionsPer1_0Server /t REG_DWORD /d 8 /f reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v MaxConnectionsPerServer /t REG_DWORD /d 8 /f @rem IE下载多线程 reg add HKU\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Explorer /v Link /t REG_BINARY /d 00000000 /f @rem 去掉快捷方式字样 reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer /v NoLowDiskSpaceChecks /t REG_DWORD /d 1 /f @rem 取消磁盘空间太小提示 reg add HKLM\SYSTEM\CurrentControlSet\Control\FileSystem /v ConfigFileAllocSize /t REG_DWORD /d 500 /f @rem 优化文件系统 reg add HKCU\Console /v LoadConIme /t REG_DWORD /d 0 /f @rem 运行CMD时不自动加载Conime reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system /v dontdisplaylastusername /t REG_DWORD /d 1 /f @rem 不显示上次登陆用户名 reg add HKLM\SYSTEM\CurrentControlSet\Control\Lsa /v restrictanonymous /t REG_DWORD /d 1 /f @rem 不允许 SAM帐户和共享的匿名枚举 reg add HKLM\SYSTEM\ControlSet001\Control\CrashControl /v AutoReboot /t REG_DWORD /d 0 /f reg add HKLM\SYSTEM\ControlSet001\Control\CrashControl /v CrashDumpEnabled /t REG_DWORD /d 0 /f reg add HKLM\SYSTEM\ControlSet001\Control\CrashControl /v DumpFile /t REG_EXPAND_SZ /d %SystemRoot%\MEMORY.DMP /f reg add HKLM\SYSTEM\ControlSet001\Control\CrashControl /v LogEvent /t REG_DWORD /d 0 /f reg add HKLM\SYSTEM\ControlSet001\Control\CrashControl /v MinidumpDir /t REG_EXPAND_SZ /d %SystemRoot%\Minidump /f reg add HKLM\SYSTEM\ControlSet001\Control\CrashControl /v Overwrite /t REG_DWORD /d 1 /f reg add HKLM\SYSTEM\ControlSet001\Control\CrashControl /v SendAlert /t REG_DWORD /d 0 /f @rem 系统失败的几个勾全都不选 reg add HKLM\SOFTWARE\Microsoft\PCHealth\ErrorReporting /v DoReport /t REG_DWORD /d 0 /f reg add HKLM\SOFTWARE\Microsoft\PCHealth\ErrorReporting /v ShowUI /t REG_DWORD /d 0 /f @rem 禁用错误汇报,但在发生严重错误时通知我的勾不选 reg add HKCR\CLSID\{450D8FBA-AD25-11D0-98A8-0800361B1103} /v SortOrderIndex /t REG_DWORD /d 54 /f @rem 桌面第一显示我的电脑 reg add HKLM\SOFTWARE\Classes\*\shell\OpenInNotepad /ve /d 使用记事本打开 /f reg add HKLM\SOFTWARE\Classes\*\shell\OpenInNotepad\command /ve /d "notepad.exe \"%%1%\"" /f reg add HKCR\Directory\shell\DOS /ve /d 使用DOS浏览 /f reg add HKCR\Directory\shell\DOS\Command /ve /d "cmd.exe /k \"cd %%L%" /f @rem 在文件右键菜单增加 "使用记事本打开" &在文件夹右键增加使用DOS浏览 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v Favorites /t REG_EXPAND_SZ /d D:\Favorites /f reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v Personal /t REG_EXPAND_SZ /d "D:\My Documents" /f @rem 将我的文档与收藏夹放在D盘下 echo 其它优化结束,按任意键返回! pause >nul goto start :OEM cls echo 开始设置OEM信息... Copy /y OEM\*.* %windir%\system32\*.* >nul echo OEM设置信息结束,按任意键返回! pause >nul goto start :virus cls echo 开始清除根目录下的SXS病毒... FOR %%a 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 ATTRIB -R -H -S -A %%a\SXS.EXE & DEL /F /Q /A -R -H -S -A %%a\SXS.EXE & ATTRIB -R -H -S -A %%a\AUTORUN.INF & DEL /F /Q /A -R -H -S -A %%a\AUTORUN.INF echo 清除根目录下的SXS病毒结束,按任意键返回! pause >nul goto start : del cls echo 开始清理系统垃圾文件... del /f /s /q %systemdrive%\*.tmp del /f /s /q %systemdrive%\*._mp del /f /s /q %systemdrive%\*.log del /f /s /q %systemdrive%\*.gid del /f /s /q %systemdrive%\*.chk del /f /s /q %systemdrive%\*.old del /f /s /q %systemdrive%\recycled\*.* del /f /s /q %windir%\*.bak del /f /s /q %windir%\prefetch\*.* rd /s /q %windir%\temp & md %windir%\temp del /f /q %userprofile%\cookies\*.* del /f /q %userprofile%\recent\*.* del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*" del /f /s /q "%userprofile%\Local Settings\Temp\*.*" del /f /s /q "%userprofile%\recent\*.*" echo 清理系统垃圾文件结束,按任意键返回! echo . pause >nul goto start :end exit |
通过对以上的实现方式大家可以参考一下。
您可能感兴趣的文章: