Add Unblock for Downloaded Files via Explorer’s Menu

Posted: September 18, 2012 in Computers and Internet

When you download a file from the Internet, an NTFS stream is added to indicate the file came an unsafe place. This adds a layer of security when you try to open the file as you are forced to click through an are-you-sure dialog box or a document will open in safe mode. You can right-click the file, choose Properties, and select the Unblock button to remove this extra protection. The following process will allow you to right-click a downloaded file and perform the Unblock function directly from the context-sensitive menu.

I solved this “annoyance” previously using the streams.exe program. I’ve found a more elegant method using a new cmdlet in PowerShell 3.0 – “Unblock-file”.

Create the following as a REG file. Right-click and merge once created.

Windows Registry Editor Version 5.00
@="PowerShell.exe -NoProfile -NonInteractive Unblock-File -Path '%1'"

Or run from an administrative command line:

reg add HKCR\*\shell\Unblock\command /ve /d "PowerShell.exe -NoProfile -NonInteractive -Command Unblock-File -Path '%1'"

You will then have the menu option “Unblock” available when right-clicking on a file.

Did you unzip a file already? Unblock at the extracted folder level all contained files.

reg add HKCR\folder\shell\Unblock\command /ve /d "PowerShell.exe -NoProfile -NonInteractive -Command Get-ChildItem '%1' -recurse | Unblock-File"

If you want to get rid of the quick pop-up PowerShell command window (no, adding “-WindowStyle Hidden” doesn’t work) you can put PSRun.exe in your path and replace ‘PowerShell.exe’ with ‘PSRun.exe’ in the registry edit.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s