:start CLS COLOR 1f Rem 使用COLOR命令對控制臺輸出顏色進行更改 MODE con: COLS=32 LINES=21 Rem MODE語句為設定窗體的寬和高 Set tm1=%time:~0,2% Set tm2=%time:~3,2% Set tm3=%time:~6,2% Echo %date% %tm1%點%tm2%分%tm3%秒 Echo ================================ Echo 請選擇要進行的操作,然后按回車 Echo ─────────────── Echo. Echo A. 一鍵搞定/全自動設置服務器 Echo 0. 清理系統垃圾文件 Echo 1. 給系統危險文件設置權限 Echo 2. 給系統危險文件夾設置權限 Echo 3. 系統服務優化 Echo 4. 注冊表危險組件刪除 Echo 5. 防DDOS洪水攻擊處理 Echo 6. 導入常來網專用安全策略 Echo 7. 重啟IIS使設置生效 Echo 8. 刷新當前時間 Echo 9. 鎖定計算機 Echo L. 注銷當前用戶 Echo Q. 退出安全設置器 Echo.
:cho Set Choice= Set /P Choice=選擇: Rem 設定變量"Choice"為用戶輸入的字符 If Not "%Choice%"=="" Set Choice=%Choice:~0,1% Rem 如果輸入大于1位,取第1位,比如輸入132,則返回值為1 Echo. If /I "%Choice%"=="A" Goto Auto If /I "%Choice%"=="0" Goto Clear If /I "%Choice%"=="1" Goto SetFile If /I "%Choice%"=="2" Goto SetFolder If /I "%Choice%"=="3" Goto Service If /I "%Choice%"=="4" Goto Reg If /I "%Choice%"=="5" Goto Ddos If /I "%Choice%"=="6" Goto Ipsec If /I "%Choice%"=="7" Goto restartiis If /I "%Choice%"=="8" Goto start If /I "%Choice%"=="9" Goto lock If /I "%Choice%"=="L" Goto logoff If /I "%Choice%"=="Q" Goto End Rem 為避免出現返回值為空或含空格而導致程序異常,需在變量外另加雙引號 Rem 注意,If語句需要雙等于號 Rem 如果輸入的字符不是以上數字,將返回重新輸入 Echo 選擇無效,請重新輸入 Echo. Goto cho
:Clear CLS MODE con: COLS=80 LINES=18 COLOR 70 Echo. Echo 正在清理系統垃圾文件,請稍等...... del /f /s /q %systemdrive%\*.tmp del /f /s /q %systemdrive%\*._mp 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\*.* del /f /s /q %windir%\temp\*.* del /f /s /q %userprofile%\cookies\*.* del /f /s /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\*.*"