China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-09 15:40
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Original] Batch file doesn't work????? View 767 Replies 2
Original Poster Posted 2008-08-27 03:57 ·  中国 广东 深圳 龙岗区 电信
新手上路
clilover
Credits 15
Posts 11
Joined 2008-07-08 14:13
18-year member
UID 121244
Gender Male
From 广东
Status Offline
echo Checking the locations of Cookies, History, and other directories (current user)...
reg query "HKCU\software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v Cache>%temp%\cleantmp.txt
reg query "HKCU\software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v Cookies>>%temp%\cleantmp.txt
reg query "HKCU\software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v History>>%temp%\cleantmp.txt
reg query "HKCU\software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v NetHood>>%temp%\cleantmp.txt
reg query "HKCU\software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v Recent>>%temp%\cleantmp.txt
echo Cleaning Cookies, IE cache, History, etc. (current user)...
for /f "tokens=3*" %%a in (%temp%\cleantmp.txt) do (
for /d %%i in ("%%a %%b\*.*") do rd /s /q "%%i">nul 2>&1
del /a /f /s /q "%%a %%b\*.*">nul 2>&1
)
Why does the above code never clean IE completely, or simply not work at all?
Floor 2 Posted 2008-08-27 10:00 ·  美国 惠普HP
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
%temp%\cleantmp.txt
This path has spaces, right? You need to add double quotes:
for /f "usebackq tokens=3*" %%a in ("%temp%\cleantmp.txt") do (


Also, before the code has been tested successfully, I suggest removing >nul 2>&1
Floor 3 Posted 2008-08-27 20:02 ·  中国 广东 深圳 龙岗区 电信
新手上路
clilover
Credits 15
Posts 11
Joined 2008-07-08 14:13
18-year member
UID 121244
Gender Male
From 广东
Status Offline
Thanks
Forum Jump: