Created
December 26, 2018 18:52
-
-
Save PsCustomObject/6c22b6cb040d195f05ebb9df1a772bff to your computer and use it in GitHub Desktop.
PowerShell Measure Script Exeuction time via StopWatch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Full post https://pscustomobject.github.io/powershell/how%20to/PowerShell-Measure-Execution-Time/ | |
# Full Type Name would be System.Diagnostics.Stopwatch | |
# Start the stopwatch | |
$stopWatch = [Diagnostics.Stopwatch]::StartNew() | |
# Define search path | |
[string]$userFolder = 'Users/PsCustomObject/Desktop/' | |
# Get all files and recurse in subfolders | |
Get-ChildItem -Path $userFolder -Recurse | |
# Alt the stopwatch | |
$stopWatch.Stop() | |
# Print elapsed time | |
$stopWatch.'Elapsed' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Support Gist for https://pscustomobject.github.io/powershell/how%20to/PowerShell-Measure-Execution-Time/