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-06-30 02:30
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » How to use DOS and Notepad to make an automatic thing to clear differences? View 1,278 Replies 5
Original Poster Posted 2006-10-01 06:20 ·  中国 广东 深圳 电信
新手上路
Credits 5
Posts 1
Joined 2006-10-01 05:11
19-year member
UID 64213
Gender Male
From 深圳
Status Offline
For example, how to clear the files in C:\Documents and Settings\Administrator\Templates
Floor 2 Posted 2006-10-01 08:46 ·  中国 广东 佛山 广东睿江科技有限公司
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
You can use the method of deleting the entire directory and then recreating this directory:

@echo off
rd /q /s "C:\Documents and Settings\Administrator\Templates"
md C:\Documents and Settings\Administrator\Templates


  In addition, post another batch script for deleting system junk files circulating online, I have slightly modified it, you can think about it:

@echo off
echo Clearing system junk files, please wait...
del /a /f /s /q "%systemdrive%\*.tmp"
del /a /f /s /q "%systemdrive%\*._mp"
del /a /f /s /q "%systemdrive%\*.log"
del /a /f /s /q "%systemdrive%\*.gid"
del /a /f /s /q "%systemdrive%\*.chk"
del /a /f /s /q "%systemdrive%\*.old"
del /a /f /s /q "%systemdrive%\recycled\*.*"
del /a /f /s /q "%windir%\*.bak"
del /a /f /s /q "%windir%\prefetch\*.*"
rd /s /q %windir%\temp && md %windir%\temp
rem del /a /f /q "%userprofile%\cookies\*.*"
rem del /a /f /q "%userprofile%\recent\*.*"
rem del /a /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"
rem del /a /f /s /q "%userprofile%\Local Settings\Temp\*.*"
rem del /a /f /s /q "%userprofile%\recent\*.*"
echo System junk cleared!
echo. & pause
尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。
Floor 3 Posted 2006-10-01 09:21 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
19-year member
UID 59080
Status Offline

rem del /a /f /q "%userprofile%\cookies\*.*"
rem del /a /f /q "%userprofile%\recent\*.*"
rem del /a /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"
rem del /a /f /s /q "%userprofile%\Local Settings\Temp\*.*"
rem del /a /f /s /q "%userprofile%\recent\*.*"


Why does the moderator add a rem in front? Adding this makes the code behind it useless, right?

But I admire the moderator's enthusiasm and earnestness, and I've bookmarked it...
Floor 4 Posted 2007-04-01 14:04 ·  中国 湖北 潜江 电信
高级用户
★★★
Credits 894
Posts 411
Joined 2007-02-17 12:15
19-year member
UID 79697
Gender Male
Status Offline
Indeed as the third floor said
@set c= 不知则觉多,知则觉少,越知越多,便觉越来越少. --- 知多少.
@for,/l,%%i,in,(1,1,55)do,@call,set/p=%%c:~%%i,1%%<nul&ping/n 1 127.1>nul


Floor 5 Posted 2007-04-02 00:00 ·  中国 广东 广州 联通
银牌会员
★★★
Credits 1,206
Posts 517
Joined 2007-03-25 01:18
19-year member
UID 82819
Gender Male
Status Offline
Originally posted by namejm at 2006-9-30 07:46 PM:
  You can use the method of deleting the entire directory and then recreating this directory:

@echo off
rd /q /s "C:\Documents and Settings\Administrator\Templates"
md C:\Documents and Settings\ ...


I used that script along with some scripts I wrote specifically for the company's network situation to make a script that supports domain computers. And even if someone changes the save path, it won't go wrong.

Now the internal version number of the company is: Vision :1.01.13E version
And the initial version number started with v0.01.
Then after 7 code rewrites (each rewrite is an improvement of my batch processing skills), because users will always give you some strange problems. And I have to consider these problems. Instead, I ignored the simplicity of the code...
In this way, it has been updated more than 150 times in 7 months. Now basically no problems occur when using any computer. And there are prompts for the problems that occur. Just recently, this code may be upgraded again.
Here I learned simplicity again. (I will rewrite all the code again in full when it doesn't affect security)
知,不觉多。不知,乃求知
Floor 6 Posted 2007-04-02 07:47 ·  德国
初级用户
Credits 36
Posts 14
Joined 2007-03-31 17:31
19-year member
UID 83522
Gender Male
Status Offline
Forum Jump: