天天看点

用脚本写的 网络/系统诊断/垃圾清理三合一

最近在学习脚本方面的知识,写了一个很简单的BAT文件,大家把以下内容复制粘贴到文本文档里面然后把后缀改成 .BAT文件双击即可应用,欢迎高手赐教加入更多的功能。

@echo off

cls

title 网络/系统诊断/垃圾清理三合一 ---制作:allanfan

:menu

mode con cols=80 lines=27 & color 1A

echo.

echo ================================================

echo 请选择要进行的操作,然后按回车

echo 1.查看主机/设备是否在线正常运行

echo 2.查看本机IP配置信息

echo 3.清理系统垃圾,提高启动速度

echo Q.退出

:cho

set choice=

set /p choice= 请选择:

IF NOT "%choice%"=="" SET choice=%choice:~0,1%

if /i "%choice%"=="1" goto ping

if /i "%choice%"=="2" goto ip

if /i "%choice%"=="3" goto clean

if /i "%choice%"=="Q" goto endd

echo 选择无效,请重新输入

goto cho

:ping

set /p choice= 请输入主机/设备名或IP地址:

echo 查看主机状态的命令已开始运行.

ping %choice% 

if %ERRORLEVEL% == 0 (

echo 恭喜! 主机/设备[%choice%]网络正常

echo ==================================

echo 按任意键返回主菜单继续

pause >Nul

goto menu

) ELSE (

mode con cols=80 lines=27 & color ce

echo 主机/设备[%choice%]网络异常,或你输入的主机名/IP地址不正确,请检查确认!

)

:ip

echo 主机IP配置信息如下:

ipconfig /all

:clean

echo 正在清除系统垃圾文件,请稍等......

del /f /s /q %systemdrive%\*.tmp

del /f /s /q %systemdrive%\temp\*.*

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 恭喜!你的系统垃圾文件清除完成!

:endd

color 1A

title goodbye 

     本文转自allanhi 51CTO博客,原文链接:http://blog.51cto.com/allanfan/204253,如需转载请自行联系原作者

继续阅读