Question:
I found that I can measure execution time on Windows with this command:
1 2 |
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
1 2 |
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?
Answer:
try
1 2 |
Measure-Command {start-process python -ArgumentList (".\script.py", "file.txt", 100) -Wait} |