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-01 23:16
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Another tough one for everyone. This program has to be finished by tomorrow morning! View 1,246 Replies 6
Original Poster Posted 2006-07-02 01:27 ·  中国 广东 珠海 中移铁通
初级用户
Credits 134
Posts 44
Joined 2005-11-12 18:42
20-year member
UID 45131
Status Offline
Describe how to delete junk files in the following file paths
C:\WINDOWS\Downloaded Program Files\
C:\Documents and Settings\Administrator\Local Settings\Temporary Internet Files
C:\Documents and Settings\Administrator\Local Settings\
C:\Documents and Settings\Administrator\Local Settings\Temp
The DEL command does not work
And changing the attributes doesn't work either. It says the path cannot be found! Which expert can give me the key point?
I've already done half of the batch file, only the above is left.
del C:\WINDOWS\Temp\*.*/p
del C:\WINDOWS\Downloaded Program Files\*.*/p
del C:\WINDOWS\Tasks\*.*/p
But the above files cannot find the path,

[ Last edited by molicn on 2006-7-2 at 01:29 ]
Floor 2 Posted 2006-07-02 11:11 ·  中国 上海 松江区 电信
铂金会员
★★★★
DOS一根葱
Credits 5,493
Posts 2,315
Joined 2006-05-01 10:41
20-year member
UID 54766
Gender Male
From 上海
Status Offline
del “C:\Documents and Settings\Administrator\Local Settings\Temporary Internet Files\*.*" /p
del "C:\WINDOWS\Downloaded Program Files\*.*" /p
Folders with spaces must be enclosed in “”
Floor 3 Posted 2006-07-02 13:05 ·  中国 广东 珠海 中移铁通
初级用户
Credits 134
Posts 44
Joined 2005-11-12 18:42
20-year member
UID 45131
Status Offline
I tried it, it said the path couldn't be found. Brother, I only gave everyone this tough problem because the above batch commands didn't work when I tried them.
Floor 4 Posted 2006-07-02 13:57 ·  中国 上海 松江区 电信
铂金会员
★★★★
DOS一根葱
Credits 5,493
Posts 2,315
Joined 2006-05-01 10:41
20-year member
UID 54766
Gender Male
From 上海
Status Offline
The Temporary Internet Files and Temp folders are not fixed. You should use variable paths such as %TEMP%, look up the related variable names in the registry, or google it. Some of them can be obtained in cmd with set.
Floor 5 Posted 2006-07-02 13:57 ·  中国 四川 成都 鹏博士宽带
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
  You have to remove the folder's "system + hidden + read-only" attributes first, and then del "C:\WINDOWS\Downloaded Program Files\*.*" /p won't give an error message.

  As for the "C:\Documents and Settings\Administrator" folder, since I haven't switched to it on my machine, I don't know whether removing attributes will work. I guess the path not found message is precisely because you haven't switched to the administrator user.
Floor 6 Posted 2006-07-02 16:03 ·  中国 广东 珠海 电信
初级用户
Credits 112
Posts 40
Joined 2006-06-23 19:52
20-year member
UID 57473
Gender Male
Status Offline
I'll give you the full statement that I collected. This is a ready-made bat file for clearing system junk files.


@echo off

del/f/s/q %systemdrive%\*.tmp

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 %windir%\*.bak

del/f/q %systemdrive%\recycled\*.*

del/f/q %windir%\prefetch\*.*

rd/s/q %windir%\temp & md %windir%\tempemp% &md %temp%

del/f/q %userprofile%\cookies\*.*

del/f/q %userprofile%\recent\*.*

rd/s/q \"%userprofile%\Local Settings\Temporary Internet Files\"

cls & echo System junk cleanup complete :)

echo. & pause
Floor 7 Posted 2006-07-02 16:30 ·  中国 四川 成都 鹏博士宽带
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
  Hehe, is the one above the "Online Flying Fox System Junk Cleaner"?

  I've used his cleaner before, and during use it would give a prompt roughly saying that some files could not be cleared. Now after your post and thinking about it again, I guess it's because when using * to represent all files of a certain type, the author didn't take into account filenames with spaces, or perhaps some file is in use (this possibility is relatively small). Since the temporary files on my machine are rather important to me, I don't want to run the modified code for now. Please, the poster above, try putting quotes around the path in every statement.
Forum Jump: