【问题标题】:Measure-Command: measure python script execution timeMeasure-Command:测量python脚本执行时间
【发布时间】:2016-04-22 14:27:09
【问题描述】:

我发现我可以用这个命令在 Windows 上测量执行时间:

Measure-Command {start-process python .\script.py -Wait}

而且效果很好。不幸的是,当我尝试运行带有一些(位置和可选)参数的脚本时,我收到一条错误消息,其中

Measure-Command {start-process python .\script.py file.txt 100 -Wait}

我得到错误:

Start-Process:找不到接受参数“file.txt”的位置参数。

没有 Measure-Command 一切正常。

我做错了什么?如何测量带参数的脚本的执行时间?

【问题讨论】:

    标签: python windows powershell execution-time


    【解决方案1】:

    试试

    Measure-Command {start-process python -ArgumentList (".\script.py", "file.txt", 100) -Wait}
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-06-14
      • 1970-01-01
      • 2019-02-07
      • 2011-09-08
      • 2014-01-19
      • 2020-11-24
      • 2018-06-01
      • 1970-01-01
      相关资源
      最近更新 更多