大家好!我是菜鸟一只,我对精通DOS的人总是佩服得五体投地,现在通过这个论坛我也学到了不少DOS知识,下面我自编了一个批处理文件(命名为Norun.bat),它可以通过修改注册表来限制计算机的使用,恳请各路大侠不吝指正!
下面是Norun.bat的内容(为了叙述方便,加上了段落标记):
第一段
pause
第二段
@ECHO off
regedit -s d:\norun.reg
第三段
@ECHO off
ren c:\windows\regedit.exe yjf.exe
第四段
@echo off
ren C:\WINDOWS\SYSBCKUP\RB000.CAB yjf
第五段
@echo off
attrib "c:\windows\start menu\*.*" +h /s
第六段
@ECHO off
C:\Windows\Rundll.exe user.exe,exitwindowsexec
在运行该批处理文件前,必须做好准备工作:在D盘下建立“norun.reg”和“run.reg”以及“警告声音.wav”这三个文件。
在运行该批处理文件后,电脑将强行重启,自检后蹦出一个警告框,然后又从音箱中传出警告声音。这还不算,桌面上空空如也,打开资源管理器连一个驱动器也没有。更要命的是似乎什么程序也运行不了!
我再对Norun.bat做一些注解:
第一段,用pause暂停命令防止误运行。
第二段是将norun.reg文件合并到注册表,这是锁定计算机的关键。其中,在regedit命令后加参数“-s”的作用是无须确认而直接把reg文件注入到注册表。下面着重说明norun.reg的内容:
REGEDIT4
"RestrictRun"=dword:00000001 (禁止运行任何程序)
"nodrives"=dword:ffffffff (隐藏所有驱动器)
"nodesktop"=dword:00000001 (隐藏桌面)
"1"="run.bat" (允许运行run.bat,这是解锁用的批处理文件,下文将详细介绍)
"2"="run.pif" (这是指允许运行run.bat的快捷方式,如果没有这一项的话,则在解锁时只能运行run.bat的原文件而不能运行其快捷方式)
"3"="regedit.exe" (必须允许运行注册表编辑器,否则我们自己也无法快速解锁。至于怎样使他人无法运行注册表编辑器,将在下文阐述)
"LegalNoticeCaption"="我不欢迎你!!!"
"LegalNoticeText"="未经授权,不得运行任何程序!!如有急事,请联系杨上当。"
(这是警告框,在电脑开机自检后它就会蹦出来)
@="D:\\警告声音.wav"
(替代了原来Windows的启动声音,对非法用户做进一步的警告。)
第三段是防止他人运行注册表编辑器。把regedit.exe改名为“yjf.exe”,这样,不明就里的人可就无法运行注册表编辑器啦!
第四段是把系统中的注册表备份文件改名,这样就防止他人在DOS下通过运行“scanreg /restore”来恢复注册表了!狠吧?
第五段是把开始菜单中的所有快捷方式都设置隐藏属性,这样开始菜单就会空空如也啦!为了达到这个目的,必须注意把路径加引号,因为DOS不认识有空格的文件名!
第六段是命令电脑重新启动。
下面是解锁用的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
这个批处理文件是非常好理解的,在此无须赘述,只对run.reg的内容做出说明:
REGEDIT4
"RestrictRun"=dword:00000000
"nodesktop"=dword:00000000
"nodrives"=dword:00000000
(解除对程序的锁定、还原桌面、恢复显示驱动器)
"LegalNoticeCaption"=""
"LegalNoticeText"=""
(取消警告框)
@="C:\\WINDOWS\\media\\The Microsoft Sound.wav"
(还原启动时的默认声音)
重启或注销后,电脑恢复原状。
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.