![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-08-04 11:10 |
48,038 topics / 350,123 posts / today 0 new / 48,251 members |
| DOS批处理 & 脚本技术(批处理室) » Delete All Files and Directories |
| Printable Version 752 / 4 |
| Floor1 bgwzlgf9610 | Posted 2007-04-29 04:15 |
| 初级用户 Posts 12 Credits 30 | |
|
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 |
|
| Floor2 zhoushijay | Posted 2007-04-29 04:18 |
| 高级用户 Posts 375 Credits 845 | |
|
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??? -_-! |
|
| Floor3 zhoushijay | Posted 2007-04-29 04:30 |
| 高级用户 Posts 375 Credits 845 | |
|
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 ] |
|
| Floor4 bgwzlgf9610 | Posted 2007-04-29 05:24 |
| 初级用户 Posts 12 Credits 30 | |
|
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? _^^_
|
|
| Floor5 zhoushijay | Posted 2007-04-29 05:47 |
| 高级用户 Posts 375 Credits 845 | |
|
@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 |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |