天天看點

用腳本寫的 網絡/系統診斷/垃圾清理三合一

最近在學習腳本方面的知識,寫了一個很簡單的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,如需轉載請自行聯系原作者

繼續閱讀