![]() |
中国DOS联盟-- 联合DOS 推动DOS 发展DOS --联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum |
| 游客 | 登录 | 注册 | 会员 | 搜索 | 中国DOS联盟 |
|
中国DOS联盟论坛 现在时间是 2026-08-03 09:52 |
共 48,038 主题排行 / 350,123 发帖 / 今日 0 篇 / 48,251 会员排行 |
| DOS批处理 & 脚本技术(批处理室) » 请问纯98DOS如何使用组合命令符号&& |
| 可打印版本 859 / 2 |
| 第1楼 hjting | 发表于 2007-02-10 04:44 |
| 初级用户 发帖 26 积分 84 | |
|
请问纯98DOS如何使用组合命令符号&& 本人试了,用不了
方法如下: 如何使用组合命令(Compound Command) 1.& Usage:第一条命令 & 第二条命令 [& 第三条命令...] 用这种方法可以同时执行多条命令,而不管命令是否执行成功 Sample: C:\>dir z: & dir c:\Ex4rch The system cannot find the path specified. Volume in drive C has no label. Volume Serial Number is 0078-59FB Directory of c:\Ex4rch 2002-05-14 23:51 <DIR> . 2002-05-14 23:51 <DIR> .. 2002-05-14 23:51 14 sometips.gif 2.&& Usage:第一条命令 && 第二条命令 [&& 第三条命令...] 用这种方法可以同时执行多条命令,当碰到执行出错的命令后将不执行后面的命令,如果一直没有出错则一直执行完所有命令; Sample: C:\>dir z: && dir c:\Ex4rch The system cannot find the path specified. C:\>dir c:\Ex4rch && dir z: Volume in drive C has no label. Volume Serial Number is 0078-59FB Directory of c:\Ex4rch 2002-05-14 23:55 <DIR> . 2002-05-14 23:55 <DIR> .. 2002-05-14 23:55 14 sometips.gif 1 File(s) 14 bytes 2 Dir(s) 768,671,744 bytes free The system cannot find the path specified. 在做备份的时候可能会用到这种命令会比较简单,如: dir file://192.168.0.1/database/backup.mdb && copy file://192.168.0.1/database/backup.mdb E:\backup 如果远程服务器上存在backup.mdb文件,就执行copy命令,若不存在该文件则不执行copy命令。这种用法可以替换IF exist了 :) 3.|| Usage:第一条命令 || 第二条命令 [|| 第三条命令...] 用这种方法可以同时执行多条命令,当碰到执行正确的命令后将不执行后面的命令,如果没有出现正确的命令则一直执行完所有命令; Sample: C:\Ex4rch>dir sometips.gif || del sometips.gif Volume in drive C has no label. Volume Serial Number is 0078-59FB Directory of C:\Ex4rch 2002-05-14 23:55 14 sometips.gif 1 File(s) 14 bytes 0 Dir(s) 768,696,320 bytes free 组合命令使用的例子: sample: @copy trojan.exe \\%1\admin$\system32 && if not errorlevel 1 echo IP %1 USER %2 PASS %3 >>victim.txt |
|
| 第2楼 qzwqzw | 发表于 2007-02-10 06:03 |
| 银牌会员 发帖 636 积分 2,343 | |
|
98与MS-DOS均不支持&、&&及||等符号
要想实现类似的功能需要很好地掌握if,goto等命令以及批处理的标签 |
|
| 第3楼 wl00560 | 发表于 2007-02-10 12:17 |
| 银牌会员 发帖 709 积分 1,384 | |
|
纯DOS下推荐用4DOS,非常强悍的东西,现在也免费了。
|
|
|
[ 联系联盟系统管理团队 -
中国DOS联盟 -
标准版 ] Sponsored by ifanr Inc | © 2001–2023 |