2009-07-05 177 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

相關問題