Board logo

标题: 求助:解读批处理文件 [打印本页]

作者: niupidemicky     时间: 2009-2-16 12:56    标题: 求助:解读批处理文件

本人菜鸟呵,各位前辈请帮忙解读一下下面程序各行的意义。谢谢。
@echo off
PROMPT $P$G
CWSDPMI -X
lh c:\smartdrv.exe 1024 1024
d:
c:\pnc > nul
del nul
nskm
if errorlevel 1 goto Reboot
if errorlevel 0 goto Exit
:Reboot
reboot
:Exit
作者: zhengqian529     时间: 2009-2-16 14:46
看下基本的几个DOS命令就知道了:echo, prompt, lh, del, if, nskm, reboot.
作者: zhengqian529     时间: 2009-2-16 14:54
@echo off    (其后的命令不显示)
PROMPT $P$G  (以当前路径和>符号作为命令行提示符)
CWSDPMI -X   (http://www.cn-dos.net/forum/viewthread.php?tid=17903)
lh c:\smartdrv.exe 1024 1024 (将程序放入高端内存)
d: (转到D盘)
c:\pnc > nul  
del nul   (删除文件夹下的文件)
nskm   (不知道这个是什么)
if errorlevel 1 goto Reboot   (如果 errorlevel==1,转到reboot label)
if errorlevel 0 goto Exit        (如果 errorlevel==0,转到exit label)
:Reboot
reboot    (重新启动命令)
:Exit
作者: tireless     时间: 2009-2-16 16:00
这个解释有误:

  Quote:
if errorlevel 1 goto Reboot   (如果 errorlevel==1,转到reboot label)
if errorlevel 0 goto Exit        (如果 errorlevel==0,转到exit label)

应该是:

if errorlevel 1 goto Reboot   (如果 errorlevel 大于等于 1,转到reboot label)
if errorlevel 0 goto Exit        (如果 errorleve 大于等于 0,转到exit label)