双命令在命令提示符中运行程序

时间:2009-07-05 03:16:18

标签: windows command-line windows-ce cmd command

请帮助我:如何在 cmd 中添加一个双重命令,就像在Linux中一样apt-get install firefox && cp test.py /home/python/,但是如何在Windows中执行此操作? Windows CE,但在Windows和Windows CE中是相同的,因为 cmd 是相同的。谢谢!

2 个答案:

答案 0 :(得分:5)

如果CE与XP Pro相同(我不确定你是否正确),你可以使用相同的方法:

dir && echo hello

此处它在我的Windows VM(XP SP3)上运行:

C:\Documents and Settings\Pax>dir && echo hello
 Volume in drive C is Primary
 Volume Serial Number is 04F7-0E7B

 Directory of C:\Documents and Settings\Pax

29/06/2009  05:00 PM    <DIR>          .
29/06/2009  05:00 PM    <DIR>          ..
17/01/2009  12:38 PM    <DIR>          Desktop
: : :
29/06/2009  05:00 PM             4,487 _viminfo
          14 File(s)         51,658 bytes
           9 Dir(s)  13,424,406,528 bytes free
hello

C:\Documents and Settings\Pax>

一些有用的多命令选项是:

cmd1 &  cmd2 - run cmd1 then run cmd2.
cmd1 && cmd2 - run cmd1 then, if cmd1 was successful, run cmd2.
cmd1 || cmd2 - run cmd1 then, if cmd1 was not successful, run cmd2.

答案 1 :(得分:2)