联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!
if exist 1.txt if exist 2.txt (start "" 1.txt && start "" 2.txt)
@echo off dir /a-d 1.txt || goto next dir /a-d 2.txt || goto next start "" 1.txt & start "" 2.txt goto :eof :next del 1.txt 2.txt 2>nul goto :eof
@echo off if exist 1.txt if exist 2.txt (start "" 1.txt && start "" 2.txt) else (del 1.txt 2.txt 2>nul)
& [...] command1 & command2 用来分隔一个命令行中的多个命令。Cmd.exe 运行第一个命令,然后运行第二个命令。 && [...] command1 && command2 只有在符号 && 前面的命令成功时,才用于运行该符号后面的命令。Cmd.exe 运行第一个命令,然后只有在第一个命令运行成功时才 运行第二个命令。 || [...] command1 || command2 只有在符号 || 前面的命令失败时,才用于运行符号 || 后面的命令。Cmd.exe 运行第一个命令,然后只有在第一个命令未能运行成 功(接收到大于零的错误代码)时才运行第二个命令。 ( ) [...] (command1 & command2) 用来分组或嵌套多个命令。 ; 或者 , command1 parameter1;parameter2 用来分隔命令参数。 注意 “与”符号 (&)、管道符号 (|) 以及括号 () 是特殊字符,将它们作为参数传递时,必须在其前面加上转义字符 (^) 或引号。 如果某个命令成功完成操作,则该命令就返回零 (0) 退出代码或不返回任何退出代码。有关退出代码的详细信息,请参阅 Microsoft Windows Resource Kit。
START ["title"] [/Dpath] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED] [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL] [/WAIT] [/B] [command/program] [parameters] "title" 在窗口标题栏中显示的标题。 ……
if [not] exist filename.txt ( echo 1 echo 2 echo 3 ) else ( echo 4 echo 5 echo 6 )