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-04 10:09
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Delete All Files and Directories View 751 Replies 4
Original Poster Posted 2007-04-29 04:15 ·  中国 内蒙古 包头 联通
初级用户
我很想学DOS
Credits 30
Posts 12
Joined 2007-04-28 04:32
19-year member
UID 86736
Gender Male
Status Offline
Recently, students in the computer room often use USB flash drives to copy games onto the computers. Since restore cards are installed, the contents of drive C: are restored every time the machines reboot, but the contents of drives d: and e: often have to be deleted manually, which is very inconvenient. Taking advantage of this rework of the computer room, I added a batch file to the c: drive of the student machines. From now on, the teacher machine only needs one mouse click to make all the student machines run this batch file and that's OK.
The contents are as follows:
cmd /c
del d:\. /s /q /f
rd d:\. /s /q
del e:\. /s /q /f
rd e:\. /s /q
Floor 2 Posted 2007-04-29 04:18 ·  中国 新疆 乌鲁木齐 电信
高级用户
★★★
Autowalk
Credits 845
Posts 375
Joined 2007-03-03 01:58
19-year member
UID 80606
Gender Male
Status Offline
You could put one in the startup items of all the student machines, and delete all directories before each machine starts up.

But... I just came from being a student too, isn't this a bit too cruel???
-_-!
Floor 3 Posted 2007-04-29 04:30 ·  中国 新疆 乌鲁木齐 电信
高级用户
★★★
Autowalk
Credits 845
Posts 375
Joined 2007-03-03 01:58
19-year member
UID 80606
Gender Male
Status Offline
Cruel is cruel, whatever, can't worry about that much. If this bunch of brats won't behave, then hit them hard

@echo off
for %%d in (d: e:) do (
for /l %%i in (1,1,255) do (
del /s /q \\192.168.1.%%i\%%d\
)
)

The code hasn't been tested. I wouldn't dare test this code. Please change the IP address yourself.

[ Last edited by zhoushijay on 2007-4-28 at 03:33 PM ]
Floor 4 Posted 2007-04-29 05:24 ·  中国 内蒙古 包头 联通
初级用户
我很想学DOS
Credits 30
Posts 12
Joined 2007-04-28 04:32
19-year member
UID 86736
Gender Male
Status Offline
I don't dare try code like this on my own machine either, but I think the numbers on the third line (1,1,255) should be changed, because the teacher machine's IP is 161. If it's not changed, then wouldn't this delete your own contents too? _^^_
Floor 5 Posted 2007-04-29 05:47 ·  中国 新疆 乌鲁木齐 电信
高级用户
★★★
Autowalk
Credits 845
Posts 375
Joined 2007-03-03 01:58
19-year member
UID 80606
Gender Male
Status Offline
@echo off

for %%d in (d: e:) do (
for /l %%i in (1,1,255) do (
if %%i neq 161 (
del /s /q \\192.168.1.%%i\%%d\
)

)
)
:end

pause>nul


Try this first, and if there are errors then change it again
Forum Jump: