我前两天才开始接触批处理,这几天狠啃这块,感觉这个例子对于新手熟悉命令还是很好的啊,而且感觉也能感受到一点程序化设计的方法:先整体框架,再在框架里写功能模块,很好的,顶一个!楼主代码最后没有做到自动恢复的功能,这样一些电脑不够好的朋友可能真的误认为是蓝屏而重启电脑。现修改了楼主一点点的代码,以实现自动恢复功能:- @echo off
- echo.
- :head
- set/p var=请任意猜一个数字:
- echo 你猜错了,所以电脑蓝屏了,做为对你的惩罚,哈哈!!!!
- if %var%==2010 goto right else goto error
- :error
- > temp.hta echo ^<html^>
- >>temp.hta echo ^<HTA:APPLICATION Application BORDER="None" WINDOWSTATE="Maximize" SCROLL="No" INNERBORDER="No" SELECTION="No"/^>
- >>temp.hta echo ^<body style="background-color:#00D;color:#EEE;font-family:consolas;font-size:12pt;font-weight:lighter;cursor:url(fuck);"^>
- >>temp.hta echo A problem has been detected and windows has been shut down to prevent damage^
-
- >>temp.hta echo to your computer.^
-
- >>temp.hta echo ^
-
- >>temp.hta echo NO_MORE_IRP_STACK_LOCATIONS^
-
- >>temp.hta echo ^
-
- >>temp.hta echo If this is the first time you've seen this stop error screen,^
-
- >>temp.hta echo restart your computer.If this screen appears again,follow^
-
- >>temp.hta echo these steps:^
-
- >>temp.hta echo ^
-
- >>temp.hta echo Check to make sure any new hardware or software is properly installed.^
-
- >>temp.hta echo If this is a new installation, ask your hardware or software manufacturer^
-
- >>temp.hta echo for any windows updates you might need.^
-
- >>temp.hta echo ^
-
- >>temp.hta echo If problems continue,disable or remove any newly installed hardware^
-
- >>temp.hta echo or software. Disable BIOS memory options such as caching or shadowing.^
-
- >>temp.hta echo If you need to use safe Mode to remove or disable components, restart^
-
- >>temp.hta echo your computer,press F8 to select Advanced startup Options,and then^
-
- >>temp.hta echo select safe mode.^
-
- >>temp.hta echo ^
-
- >>temp.hta echo Technical information:^
-
- >>temp.hta echo ^
-
- >>temp.hta echo *** STOP: 0x00000024 (0x001902FE,0xF7A4F660,0xF7A4F35C,0xF73CB7B6)^
-
- >>temp.hta echo ^
-
- >>temp.hta echo *** ntfs.sys - address F73CB7B6 base at F73CB000, Datestamp 41107eea^
-
- >>temp.hta echo ^
-
- >>temp.hta echo Beginning dump of physical memory^
-
- >>temp.hta echo Physical memory dump complete.^
-
- >>temp.hta echo Contact your system administrator or technical support group for further^
-
- >>temp.hta echo assistance.^
-
- >>temp.hta echo ^</body^>
- >>temp.hta echo ^</html^>
- start temp.hta && taskkill /f /im explorer.exe>nul
- ping 127.0.0.1 -n 10> nul
- taskkill /f /im mshta.exe>nul && del temp.hta && C:\WINDOWS\explorer.exe
- :right
- cls
- echo 你也太聪明了吧,这都能猜到,没意思,我走了……
- pause>nul
复制代码
|