Skip to content

Instantly share code, notes, and snippets.

@devlights
Created April 20, 2018 02:24
Show Gist options
  • Save devlights/bea07c7168b3243691fdbe403f2b25ae to your computer and use it in GitHub Desktop.
Save devlights/bea07c7168b3243691fdbe403f2b25ae to your computer and use it in GitHub Desktop.
[windows][powershell] linux や mac の time コマンドに近いものを windows で (実行時間を計測)

linux や mac の time コマンドに近いものを windows で

Powershell の Measure-Command を利用する

$ Measure-Command { Start-Process python -argumentList "test1.py" -Wait -NoNewWindow }

-Wait-NoNewWindow をつけないとうまくいかない。

@devlights
Copy link
Author

@devlights
Copy link
Author

秒数のみ表示したい場合は

$ Measure-Command { Start-Process python -argumentList "test1.py" -Wait -NoNewWindow } | Select-Object -Property TotalSeconds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment