I'm trying to write a script for measure execution time of a program.
If I type the command Measure-Command
directly on PowerShell it work.
If I include that command in a script, then PowerShell tell me "command not found".
Can anyone help me please?
.bat
scripts are not executed by powershell.exe
but by cmd.exe
. Since Measure-Command
is a PowerShell cmdlet, cmd.exe won't recognise it.
You can call PowerShell from a .bat
script if you like:
powershell -command "Measure-Command {Do-Something -Param1 stuff}|Select -Exp TotalSeconds" >> timing.txt