2009-07-05 211 views
1

请帮助我:如何将一个双命令放在cmd,像这样在Linux:apt-get install firefox && cp test.py /home/python/,但如何在Windows?中做到这一点,更具体的Windows CE,但它在Windows和Windows CE中是一样的,因为cmd是相同的。谢谢!双命令在命令提示符下运行程序

回答

5

如果CE是一样的XP专业版(我不知道你是对的),你可以用同样的方法:

dir && echo hello 

这是运行在我的Windows虚拟机(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. 
+0

谢谢!,非常好详细! – 2009-07-05 12:09:46