2016-01-17 84 views
3

我發現我可以衡量的執行時間在Windows上使用此命令:措施命令:措施python腳本的執行時間

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

和它的偉大工程。不幸的是,當我試圖運行一個腳本這需要一些(位置和可選的)參數,我得到一個錯誤信息,與

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

我得到的錯誤:

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

沒有辦法,命令一切工作正常。

我在做什麼錯?如何測量帶參數的腳本的執行時間?

回答

3

嘗試

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