【问题标题】:Executing Powershell from qmake hangs indefinitely从 qmake 执行 Powershell 无限期挂起
【发布时间】:2019-12-05 22:50:45
【问题描述】:

我正在尝试从 qmake 中执行 Powershell 命令。简化的.pro 文件如下所示:

$$system(powershell -NonInteractive -Command \"[long]((date).touniversaltime()-[datetime]'1970-01-01').totalmilliseconds\")

但是,使用此文件运行 qmake 或在 QtCreator 中打开它会创建一个无限期挂起的powershell.exe 进程。从命令行运行 Powershell 没有问题,该命令会打印预期的时间戳并立即退出。

什么可能导致此挂起以及如何解决?

在带有 Powershell 2.0 版和 qmake 3.1 版/Qt 5.9.8 的 Windows 7 x64 上测试。

【问题讨论】:

    标签: windows powershell qmake


    【解决方案1】:

    不要使用引号。 可能的命令是:

    $$system(powershell -Command Get-Date -Format "yyyy.MM.dd.HH.mm")
    

    【讨论】:

      猜你喜欢
      • 2013-02-02
      • 1970-01-01
      • 2011-05-07
      • 1970-01-01
      • 2017-06-29
      • 2011-05-07
      • 2021-04-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多