lara400
lara400

Reputation: 4736

time to write read file?

Here's a strange one...is there anyway of using powershell to see how long it takes to write a file?

So, if I create a file - can powershell tell me how long it took to create that file (ie 25ms or whatever the number is). Also, if I delete a file can it also tell me the time?

Thanks

Upvotes: 0

Views: 80

Answers (2)

David Martin
David Martin

Reputation: 12248

Measure-Command can do this for you.

e.g.

Measure-Command { new-item -Path test.txt -ItemType File -Force }

Upvotes: 2

Ansgar Wiechers
Ansgar Wiechers

Reputation: 200343

You mean something like this?

$before = Get-Date
# do stuff
$after = Get-Date
echo ($after - $before).TotalMilliseconds

Upvotes: 1

Related Questions