Hello everyone! I'm just a noob. I always admire those who are proficient in DOS. Now through this forum, I've also learned a lot about DOS knowledge. Now I made a self-written batch file (named Norun.bat) which can restrict the use of the computer by modifying the registry. I earnestly ask all experts to give comments!
Here is the content of Norun.bat (for the convenience of narration, paragraph marks are added):
Paragraph 1
pause
Paragraph 2
@ECHO off
regedit -s d:\norun.reg
Paragraph 3
@ECHO off
ren c:\windows\regedit.exe yjf.exe
Paragraph 4
@echo off
ren C:\WINDOWS\SYSBCKUP\RB000.CAB yjf
Paragraph 5
@echo off
attrib "c:\windows\start menu\*.*" +h /s
Paragraph 6
@ECHO off
C:\Windows\Rundll.exe user.exe,exitwindowsexec
Before running this batch file, you must do the preparation work: create "norun.reg", "run.reg" and "Warning Sound.wav" in the D drive.
After running this batch file, the computer will restart forcibly. After self-testing, a warning box will pop up, and then a warning sound will come out from the speaker. That's not all. The desktop is empty, and even no drive is found when opening Windows Explorer. What's worse, it seems that no program can be run!
I will make some annotations on Norun.bat:
Paragraph 1, use the pause command to prevent accidental running.
Paragraph 2 is to merge the norun.reg file into the registry, which is the key to locking the computer. Among them, the role of adding the parameter "-s" after the regedit command is to directly inject the reg file into the registry without confirmation. Now focus on explaining the content of norun.reg:
REGEDIT4
"RestrictRun"=dword:00000001 (Prohibit running any program)
"nodrives"=dword:ffffffff (Hide all drives)
"nodesktop"=dword:00000001 (Hide desktop)
"1"="run.bat" (Allow running run.bat, which is the batch file for unlocking, and the details will be introduced below)
"2"="run.pif" (This refers to allowing running the shortcut of run.bat. If this item is not available, then only the original file of run.bat can be run but not its shortcut when unlocking)
"3"="regedit.exe" (Must allow running the registry editor, otherwise we can't quickly unlock ourselves. As for how to prevent others from running the registry editor, it will be explained below)
"LegalNoticeCaption"="I don't welcome you!!!"
"LegalNoticeText"="Unauthorized use is not allowed!! If you have urgent matters, please contact Yang Shangdang."
(This is the warning box, which will pop up after the computer starts self-testing)
@="D:\\Warning Sound.wav"
(Replaces the original Windows startup sound to further warn illegal users.)
Paragraph 3 is to prevent others from running the registry editor. Rename regedit.exe to "yjf.exe", so those who don't understand can't run the registry editor!
Paragraph 4 is to rename the registry backup file in the system, so as to prevent others from restoring the registry by running "scanreg /restore" under DOS! Brutal, right?
Paragraph 5 is to set all shortcuts in the start menu to hidden attributes, so the start menu will be empty. To achieve this purpose, it must be noted to put the path in quotes, because DOS doesn't recognize file names with spaces!
Paragraph 6 is to command the computer to restart.
Here is the content of the unlocking run.bat:
pause
@echo off
ren c:\windows\yjf.exe regedit.exe
@echo off
attrib "c:\windows\start menu\*.*" -h /s
@ECHO off
regedit -s d:\run.reg
This batch file is very easy to understand, and no need to elaborate here. Only explain the content of run.reg:
REGEDIT4
"RestrictRun"=dword:00000000
"nodesktop"=dword:00000000
"nodrives"=dword:00000000
(Unlock the program, restore the desktop, and restore the display of drives)
"LegalNoticeCaption"=""
"LegalNoticeText"=""
(Remove the warning box)
@="C:\\WINDOWS\\media\\The Microsoft Sound.wav"
(Restore the default sound at startup)
After restarting or logging off, the computer returns to normal.
Here is the content of Norun.bat (for the convenience of narration, paragraph marks are added):
Paragraph 1
pause
Paragraph 2
@ECHO off
regedit -s d:\norun.reg
Paragraph 3
@ECHO off
ren c:\windows\regedit.exe yjf.exe
Paragraph 4
@echo off
ren C:\WINDOWS\SYSBCKUP\RB000.CAB yjf
Paragraph 5
@echo off
attrib "c:\windows\start menu\*.*" +h /s
Paragraph 6
@ECHO off
C:\Windows\Rundll.exe user.exe,exitwindowsexec
Before running this batch file, you must do the preparation work: create "norun.reg", "run.reg" and "Warning Sound.wav" in the D drive.
After running this batch file, the computer will restart forcibly. After self-testing, a warning box will pop up, and then a warning sound will come out from the speaker. That's not all. The desktop is empty, and even no drive is found when opening Windows Explorer. What's worse, it seems that no program can be run!
I will make some annotations on Norun.bat:
Paragraph 1, use the pause command to prevent accidental running.
Paragraph 2 is to merge the norun.reg file into the registry, which is the key to locking the computer. Among them, the role of adding the parameter "-s" after the regedit command is to directly inject the reg file into the registry without confirmation. Now focus on explaining the content of norun.reg:
REGEDIT4
"RestrictRun"=dword:00000001 (Prohibit running any program)
"nodrives"=dword:ffffffff (Hide all drives)
"nodesktop"=dword:00000001 (Hide desktop)
"1"="run.bat" (Allow running run.bat, which is the batch file for unlocking, and the details will be introduced below)
"2"="run.pif" (This refers to allowing running the shortcut of run.bat. If this item is not available, then only the original file of run.bat can be run but not its shortcut when unlocking)
"3"="regedit.exe" (Must allow running the registry editor, otherwise we can't quickly unlock ourselves. As for how to prevent others from running the registry editor, it will be explained below)
"LegalNoticeCaption"="I don't welcome you!!!"
"LegalNoticeText"="Unauthorized use is not allowed!! If you have urgent matters, please contact Yang Shangdang."
(This is the warning box, which will pop up after the computer starts self-testing)
@="D:\\Warning Sound.wav"
(Replaces the original Windows startup sound to further warn illegal users.)
Paragraph 3 is to prevent others from running the registry editor. Rename regedit.exe to "yjf.exe", so those who don't understand can't run the registry editor!
Paragraph 4 is to rename the registry backup file in the system, so as to prevent others from restoring the registry by running "scanreg /restore" under DOS! Brutal, right?
Paragraph 5 is to set all shortcuts in the start menu to hidden attributes, so the start menu will be empty. To achieve this purpose, it must be noted to put the path in quotes, because DOS doesn't recognize file names with spaces!
Paragraph 6 is to command the computer to restart.
Here is the content of the unlocking run.bat:
pause
@echo off
ren c:\windows\yjf.exe regedit.exe
@echo off
attrib "c:\windows\start menu\*.*" -h /s
@ECHO off
regedit -s d:\run.reg
This batch file is very easy to understand, and no need to elaborate here. Only explain the content of run.reg:
REGEDIT4
"RestrictRun"=dword:00000000
"nodesktop"=dword:00000000
"nodrives"=dword:00000000
(Unlock the program, restore the desktop, and restore the display of drives)
"LegalNoticeCaption"=""
"LegalNoticeText"=""
(Remove the warning box)
@="C:\\WINDOWS\\media\\The Microsoft Sound.wav"
(Restore the default sound at startup)
After restarting or logging off, the computer returns to normal.
偶是新手,恳请各路大侠多多指正!


