PowerShell by Rick

Showing Elapsed Time in PowerShell Scripts

In PowerShell, you can show elapsed time using a simple timer script. Start by capturing the current time when your script begins with $StartTime = $(Get-Date). Then, calculate the elapsed time by subtracting the start time from the current time: $elapsedTime = $(Get-Date) - $StartTime. Format the elapsed time into hours, minutes, and seconds using the "{0:HH:mm:ss}" format and apply it to a DateTime object: $totalTime = "{0:HH:mm:ss}" -f ([datetime]$elapsedTime.Ticks)

$StartTime = $(Get-Date)
# Your script here
$elapsedTime = $(Get-Date) - $StartTime
$totalTime = "{0:HH:mm:ss}" -f ([datetime]$elapsedTime.Ticks)
Write-Host "Total elapsed time: $totalTime"

For more details and discussions, you can refer to this Stack Overflow post.

Comments (3)


3/21/2024 3:51:07 PM
Exciting news! We've uncovered an exceptional solution to enhance your SMM and reCAPTCHA challenges. By utilizing our selfhosted IPv6 proxy, you'll benefit from: Addressing Google reCAPTCHA v2 and v3 challenges with ease. Leveraging an extensive array of unique IP addresses through IPv6 proxies, ensuring seamless navigation through bot protection systems. Improving security and privacy while bypassing restrictions imposed by bot protection mechanisms. Don't let reCAPTCHA challenges hold you back. Contact us now to get started with our IPv6 proxy solution! https://srv.surge.sh/posts/proxy-v6/


3/21/2024 12:15:39 PM
TruePills, No prescription needed, Buy pills without restrictions. Money Back Guaranteed 30-day refunds. Trial ED Pack consists of the following ED drugs: Viagra Active Ingredient: Sildenafil 100mg 5 pills Cialis 20mg 5 pills Levitra 20mg 5 pills https://cutt.ly/7wC5m1Id https://externaldocuments.marketlocation.co.uk/Home/PrivacyPolicy?cookiePolicyUrl=http%3A%2F%2Ftrue-pill.top https://www.indiacompany.org/modify-company?nid=46&element=https://true-pill.top/ http://m.modestmood.com/member/login.html?returnUrl=https://true-pill.top/ http://alekxschool.ru/bitrix/click.php?goto=https://true-pill.top/ https://the-pantheon.ru/bitrix/redirect.php?goto=https://true-pill.top/ Enalaprilum Omezul Histec Acura Dafor Telfast Urisol Promat Tipramine Otreon Biofilen Larig Penester Omizac Enol Eucalen Sporostatin Migraval Hexanurat Nitten dm solone Docaciclo Domidis Levomed Spax Loric Cefutil Rapilin Equiproxen Urolong Peristab Triptizol Gri


3/21/2024 1:26:03 AM
Men dating men experience love, union, and the dream of relationships in their own unique way. https://xlilith.com/search/www-pushto-xxx-videos-com-gand-fuking-com/ In a world that embraces distinctiveness and inclusivity, same-sex relationships keep ground their place. Men who date men sail the joys and challenges of building relevant connections based on authenticity and mutual understanding. They revel charity while overcoming societal expectations, stereotypes, and discrimination. https://sexyfatmature.net/videos/42684/hard-fucking-with-a-horny-black-bbw/ Communication and emotional intimacy pleasure a crucial task in their relationships, fostering assurance and deepening their bond. As institute progresses promoting justice, it is significant to recognize and particular the angel shared between men dating men, embracing their unequalled experiences and contributions to the tapestry of kind-hearted connections.

Leave a Comment

All fields are required. Your email address will not be published.