【问题标题】:Double Command To Run Programs In The Command Prompt在命令提示符中运行程序的双重命令
【发布时间】:2010-11-08 04:15:02
【问题描述】:

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

【问题讨论】:

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


    【解决方案1】:

    如果 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.
    

    【讨论】:

      【解决方案2】:
      猜你喜欢
      • 1970-01-01
      • 2019-05-28
      • 2010-11-30
      • 2013-08-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-21
      相关资源
      最近更新 更多