|
这是我自己做的
你参考下吧
当变量存在于根目录时
发出警告!
因为用的是rd /s /q
也就是存在根目录下时,会删除整个分区的所有内容
同时读取注册表中的IE缓存进行删除
echo OFF
set tar=REG QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v Cache
for /f "skip=3 tokens=1,3" %%i in ('%tar%') do (set x=%%j)
for /f "delims=:\ tokens=1" %%i in ('echo %x%') do set qqpan=%%i:
for /f "skip=3 tokens=1,2 delims=:" %%i in ('%tar%') do (set y=%%j)
sfc /purgecache
set f1="%temp%"
set f2="%tmp%"
set f3="%qqpan%%y%"
set f4="%windir%\temp"
set f5="%windir%\SoftwareDistribution\Download"
set f6="%windir%\ime\IMJP8_1"
set f7="%windir%\ime\IMKR6_1"
for /f "delims=: tokens=1" %%i in ('echo %temp%') do set apan=%%i:
if "%temp%"=="%apan%" echo 变量TEMP在%apan%根目录!&pause
if "%temp%"=="%apan%\" echo 变量TEMP在%apan%根目录带斜杠!&pause
for /f "delims=: tokens=1" %%i in ('echo %tmp%') do set apan=%%i:
if "%tmp%"=="%apan%" echo 变量TMP在%apan%根目录!&pause
if "%tmp%"=="%apan%\" echo 变量TMP在%apan%根目录带斜杠!&pause
for /f "delims=: tokens=1" %%i in ('echo %qqpan%%y%') do set apan=%%i:
if "%qqpan%%y%"=="%apan%" echo IE缓存在%apan%根目录!&pause
if "%qqpan%%y%"=="%apan%\" echo IE缓存在%apan%根目录带斜杠!&pause
for %%i in (%f1%,%f2%,%f3%,%f4%,%f5%,%f6%,%f7%) do (rd /s /q %%i & if not exist %%i md %%i) |
|