中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

中国DOS联盟论坛
现在时间是 2026-08-11 09:34
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » 求助:解读批处理文件 查看 691 回复 3
楼 主 求助:解读批处理文件 发表于 2009-02-16 12:56 ·  中国 广东 深圳 电信
贫困用户
积分 -1
发帖 1
注册 2009-02-13 13:06
17年会员
UID 138734
性别 男
状态 离线
本人菜鸟呵,各位前辈请帮忙解读一下下面程序各行的意义。谢谢。
@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
2 发表于 2009-02-16 14:46 ·  美国 华盛顿州 金 雷德蒙德 Microsoft
初级用户
★★
积分 100
发帖 93
注册 2009-01-14 15:04
17年会员
UID 136661
性别 男
来自 湖南
状态 离线
看下基本的几个DOS命令就知道了:echo, prompt, lh, del, if, nskm, reboot.
3 发表于 2009-02-16 14:54 ·  美国 华盛顿州 金 雷德蒙德 Microsoft
初级用户
★★
积分 100
发帖 93
注册 2009-01-14 15:04
17年会员
UID 136661
性别 男
来自 湖南
状态 离线
@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
本帖最近评分记录 (共 1 条) 点击查看详情
评分人分数时间
tireless +1 2009-02-16 15:55
4 发表于 2009-02-16 16:00 ·  中国 江西 赣州 安远县 电信
银牌会员
★★★★
积分 2,025
发帖 1,122
注册 2007-09-05 20:15
18年会员
UID 96653
性别 男
状态 离线
这个解释有误:
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)
论坛跳转: