This video is somewhat based on a blog post I did ages ago. So if you prefer a written piece on this topic you can find it here: pettertech.com/2014/01/powershell-write-progress-a-step-by-step-guide/
Awesome video! I'm trying to learn PowerShell for my job to automate some mundane tasks in our IT department, this will make it look like I know what I'm doing xD Cheers!!
Agreed. Had to look it up myself and currently there doesn't seem to be any easy way to do this yet. Hopefully there will be eventually, but I suspect that this is such a niche usecase that it will not be prioritized by Microsoft
If it's one big file then write-progress can't really help you. But if it's a lot of files then you can start by getting the full list of files and then throw that into a foreach loop which then writes progress AND copies the files. Consider this example: $AllFiles = Get-ChildItem C:\test1 -Recurse $progress = 1 foreach ($SingelFile in $AllFiles) { Write-Progress -Activity "Copying files" -Status "Working on $($SingelFile)" -PercentComplete ($progress/$AllFiles.count*100) Copy-Item -Path $SingelFile.FullName -Destination "c:\test2\$($SingelFile.FullName.substring(9))" $Progress++ }
The destination part might be a little obscure there but basically what it does is set the destination to c:\test2\ followed by whatever the path was before (minus the first 9 characters, in this case c:\test1\)
This video is somewhat based on a blog post I did ages ago. So if you prefer a written piece on this topic you can find it here: pettertech.com/2014/01/powershell-write-progress-a-step-by-step-guide/
Awesome video! I'm trying to learn PowerShell for my job to automate some mundane tasks in our IT department, this will make it look like I know what I'm doing xD Cheers!!
Haha, brilliant!
Thanks, trying to write progress for backing up the reg for reg changes. This helps a lot!
Glad it was helpful!
Awesome job!! I added the child progress bar to one of my loops and it worked like a charm!
Fantastic! Glad you found a use for this!
broooooo, you just elevated my game. Thank you!
Glad to hear it!
This was so helpful. I am trying to use this in a script now. Also thanks for the Git link.
Really glad it was helpful :)
Thank you sir, I appreciate this!
My pleasure!
looking for a way to also have the progress display in the taskbar and it seems that it's not trivial...
Agreed. Had to look it up myself and currently there doesn't seem to be any easy way to do this yet. Hopefully there will be eventually, but I suspect that this is such a niche usecase that it will not be prioritized by Microsoft
This content is splendid
Thanks alot!
How to see progress for big file copy for the below line
Copy-item c:\test1 -Destination c:\test2 -Recurse
If it's one big file then write-progress can't really help you.
But if it's a lot of files then you can start by getting the full list of files and then throw that into a foreach loop which then writes progress AND copies the files.
Consider this example:
$AllFiles = Get-ChildItem C:\test1 -Recurse
$progress = 1
foreach ($SingelFile in $AllFiles) {
Write-Progress -Activity "Copying files" -Status "Working on $($SingelFile)" -PercentComplete ($progress/$AllFiles.count*100)
Copy-Item -Path $SingelFile.FullName -Destination "c:\test2\$($SingelFile.FullName.substring(9))"
$Progress++
}
The destination part might be a little obscure there but basically what it does is set the destination to c:\test2\ followed by whatever the path was before (minus the first 9 characters, in this case c:\test1\)
@@PetterTech thanks for quick help. That make scene 😉.
Dude get a drink of water