Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Measure-Command: measure python script execution time

I found that I can measure execution time on Windows with this command:

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

and it works great. Unfortunately, when I try to run a script which takes some (positional and optional) arguments, I get an error message, with

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

I get the error:

Start-Process : A positional parameter cannot be found that accepts argument 'file.txt'.

Without Measure-Command everything works fine.

What am I doing wrong? How to measure execution time for scripts which take arguments?

like image 698
user3616181 Avatar asked Jan 17 '16 10:01

user3616181


1 Answers

try

Measure-Command {start-process python -ArgumentList (".\script.py", "file.txt", 100) -Wait}
like image 141
nissefors Avatar answered Sep 24 '22 23:09

nissefors