While setting up a new computer, Windows was throwing up warnings that filesÂ transferred from a backup drive might be unsafe. The filesÂ were text and images, so the warnings were safe to ignore but the directory had over one thousand files. Rather than unblocking each file manually, Windows PowerShell makes it easy to unblock files in bulk.
- Press Win + R on the keyboard to open the Run dialog.
- In the Run box, type powershell
For one folder without subdirectories, this snippet will do the trick.â€œ$env:userprofile\Downloadsâ€œ tells PowerShell to use the Download folder for the logged in user and unblocks all files in it. Change this to the folder path you need if it’s not the Downloads folder.
get-childitem â€œ$env:userprofile\Downloadsâ€œ | unblock-file
If you have sub-directories and need to unblock everything, use the -Recurse flag:
dir â€œ$env:userprofile\Downloadsâ€œ -Recurse | Unblock-File
Want to see a report of files to be unblocked before running it? The -WhatIf flag will show you without executing.
dir â€œ$env:userprofile\Downloadsâ€œ -Recurse | Unblock-File -WhatIf