Measure-Command:测量python脚本执行时间

时间:2016-01-17 10:43:19

标签: python windows powershell execution-time

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

var appVars = require('./app.js');
// Now you can do something with appVars.db

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

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

我收到错误:

  

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

没有Measure-Command一切正常。

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

1 个答案:

答案 0 :(得分:3)

尝试

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