【问题标题】:Executing a .exe file from PowerShell and waiting until all child processes are complete从 PowerShell 执行 .exe 文件并等待所有子进程完成
【发布时间】:2020-02-06 20:14:49
【问题描述】:

我和我的同事对此感到有些困惑。在“尝试一切”的最后努力中,我运行了这个:

  cmd /c --% ""C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" update --passive --norestart --installpath "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise"

注意开头不匹配的双引号。这最终做了我们想要的。有谁知道为什么会这样?

【问题讨论】:

    标签: powershell cmd


    【解决方案1】:

    Powershell 将您的输入视为一个巨大的字符串。我很确定它只是忽略了一个双引号,部分原因是由于 --% 在您的语句开头。您可以查看此答案,该答案侧重于您输入的 --% 部分,以及它如何在您所看到的内容中发挥作用。

    Using --% in PowerShell

    【讨论】:

      【解决方案2】:

      将其放在这里,因为它对于普通评论来说太长了。 作为对 JakeOfSpade 有用答案的后续,这些是关于使用 PowerShell 运行外部东西的好文档文章。看看这些

      使用 PowerShell 和外部命令及其参数或开关。

      运行外部命令,总是需要特别考虑。

      PowerShell: Running Executables

      Solve Problems with External Command Lines in PowerShell

      Top 5 tips for running external commands in Powershell

      Using Windows PowerShell to run old command-line tools (and their weirdest parameters)

      Execution of external commands in PowerShell done right

      Part 2

      Part 3

      And this one

      当然……

      Quoting specifics

      ...很重要。

      【讨论】:

        猜你喜欢
        • 2011-06-26
        • 1970-01-01
        • 2014-01-12
        • 1970-01-01
        • 2013-08-11
        • 2014-08-23
        • 2015-05-27
        • 2022-01-23
        • 2013-02-13
        相关资源
        最近更新 更多