分类: WINDOWS
2008-11-08 19:34:52
::--------------Start-------------------------
@ Echo off
::產生日誌文件的檔名
for /f "tokens=1,1" %%a in ('date/t') do set dt=%%a
set dt1=%dt:~0,4%
set dt2=%dt:~5,2%
set dt3=%dt:~8,2%
set log=\\dg-svr03\mis\log\%dt1%%dt2%%dt3%.log
echo 日誌文件:%log%
::得到開始掃描時間
set tm1=%time:~0,2%
set tm2=%time:~3,2%
set tm3=%time:~6,2%
echo =====開始掃描 %computername% 於 %date% %tm1%時%tm2%分%tm3%秒=====>>%log%
::僅適用於繁體XP/2000/2003系統和簡體2000系統(不必區分是否為Server)
::針對2000的系統復制所需的fsutil.exe fsutil.dll文件
if exist %systemroot%\system32\fsutil.exe goto cmdmain
copy %systemroot%
\system32\fsutil.exe >nul
copy %systemroot%
\system32\ifsutil.dll >nul
:cmdmain
::檢測系統版本
::windows2000的簡繁體系統都是輸出“Fixed”
echo 開始檢測系統類型及語言版本......
ver | find "5.0" >nul && set disktype="Fixed" && set OS=Win2000 && goto cmd01
::windowsXP/2003的繁體系統輸出“固定”
ver | find "5.1" >nul && set OS=WinXP && goto chscht
ver | find "5.2" >nul && set OS=Win2003 && goto chscht
:chscht
ver | find "版本" >nul && set disktype="固定" && set lang=CHT && goto cmd01
ver | find "版本" >nul || set disktype="嘐隅" && set lang=CHS && goto cmd01
:cmd01
echo %computername% 系統為 %OS%%lang% >>%log%
if %computername%==MIS001 goto scanend
echo 開始清理相關的程序.....
for %%f in (spider.exe,sol.exe,freecell.exe,pinball.exe,winmine.exe,mshearts.exe,qq.exe) do (
if "%%f"=="*.*" goto scanend
if "%%f"=="" goto scanend
setlocal enabledelayedexpansion
for /f "delims=\" %%i in ('fsutil fsinfo drives^|find /v ""') do (
set var=%%i
set drive=!var:~-2!
fsutil fsinfo drivetype !drive!|find %disktype%>nul && del !drive!\%%f /q /s >>%log%
)
)
:scanend
set tm1=%time:~0,2%
set tm2=%time:~3,2%
set tm3=%time:~6,2%
echo =====結束掃描 %computername% 於 %date% %tm1%時%tm2%分%tm3%秒=====>>%log%
::-------------END---------------------