Shell extension to unblock downloaded files

5

4

Is there a shell extension for Windows Explorer that adds a new context menu item, which allows to unblock the downloaded file? It should work exactly as I would open the file properties and click the Unblock button.

Ideally, such a shell extension should also display an overlay icon to indicate that the file is still blocked.

Toro

Posted 2010-02-18T09:00:34.240

Reputation: 1 075

blocked by what? blocked to what? – fluxtendu – 2010-02-18T09:05:57.677

1@fluxtendu - on download some files are blocked by Windows as "unsafe content". You have to right click and select "unblock" from the properties page to be able to use it. – ChrisF – 2010-02-18T09:13:34.103

Answers

8

There's a tool from Sysinternals called streams.

This page describes how to use it. It doesn't add an option to the context menu, but does allow you to unblock a number of files at once.

I've also found this post which gives a registry file that will do the trick:

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\runas]
@="Take Ownership"
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\*\shell\runas\command]
@="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"
"IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"

[HKEY_CLASSES_ROOT\Directory\shell\runas]
@="Take Ownership"
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\Directory\shell\runas\command]
@="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"
"IsolatedCommand"="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"

which is probably closer to what you want. Copy it into Notepad, save it as something.reg on your desktop, and double click to add it to your registry.

ChrisF

Posted 2010-02-18T09:00:34.240

Reputation: 39 650

7

Download NTFSext.exe described in this Microsoft article.
This is a zipped executable. Execute it to extract the files, then extract from the StrmExt.zip the dll named StrmExt.dll. Copy the dll to C:\Windows\System32 and execute the following command:

regsvr32 C:\Windows\System32\StrmExt.dll

You now you have a new tab in the file Properties of Windows Explorer that shows you a file's streams and allows their deletion:

image

Just a little remark: There's a bug in the program in that answering No to the delete dialog will still delete stream. Another bug is that the contents of the stream are not well displayed. If you're feeling adventurous, and as the source is included, you can correct the bug (and re-post the dll).

harrymc

Posted 2010-02-18T09:00:34.240

Reputation: 306 093

1My intention to use a shell extension was a usability improvement (less mouse clicks). Your suggestion means even more clicks than opening file properties and clicking the Unblock button. – Toro – 2010-02-18T11:10:33.127

@Toro: I thought it would be useful to see what you're deleting. Otherwise, I believe that such an extension doesn't exist, although with the source of the above dll it should be easy to write (but sorry I don't have the time). – harrymc – 2010-02-18T12:34:22.623

2

You'll need streams.exe from Sysinternals (mentioned above by @ChrisF). I put mine in the c:\Windows folder so if you want it elsewhere, you'll need to change the registry fragment below accordingly.

In your favorite Notepad-like editor, create a file and call it (something like) Unblock.reg. It should contain:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\Unblock File]
"Icon"="C:\\Windows\\System32\\Shell32.dll,109"

[HKEY_CLASSES_ROOT\*\shell\Unblock File\Command]
@="\"C:\\windows\\streams.exe\" -d \"%1\""

Once you have it, double-click on the .reg file and click "Yes" when asked if you want to continue.

That's it.

N.B. I've tested and am using this with Windows 7. YMMV.

BillP3rd

Posted 2010-02-18T09:00:34.240

Reputation: 5 353

1

Here's another alternative (open notepad, paste this text, save it as .reg and then double click the new file):

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\powershell]
@="Unblock Files"

[HKEY_CLASSES_ROOT\*\shell\powershell\command]
@="C:\\\\Windows\\\\system32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe Unblock-File  -LiteralPath \"%1\""

This one doesn't need additional tools installed, as PowerShell is part of Windows (at least in recent versions), although it provides no overlay icon.

Note: credit.

mprost

Posted 2010-02-18T09:00:34.240

Reputation: 21

Unfortunately, this doesn't work. It very often just acts like the files are already unblocked when they are not. – trlkly – 2014-09-10T22:30:32.730

Sorry to hear that, it works here in Windows 8.1 x64. Could you be a little more specific as to what the problem is? Thanks. – mprost – 2014-09-11T06:52:50.433

It pops up some command prompt with red text that I don't get to read before it fails, but it seems to be saying that the file is already unblocked. But when I go check, it isn't. When I tried it on a group of files, only one file was unblocked. I'm using Windows 7 x64. (Also, don't worry about the -1: it doesn't hurt you when you only have 1 point. I mainly did it just so people would know about the problems.) – trlkly – 2014-09-11T09:21:55.877

2I changed the last line to @="\"C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe\" Unblock-File -LiteralPath \"%1\"" – Marcos – 2015-05-19T15:11:23.577

-1

Do you want to cofigure the Setting for "Data Execution Prevention" I never heard of a tool to configure this directly from the context menu, but perhaps a serach for DEP would help you.

Crujach

Posted 2010-02-18T09:00:34.240

Reputation: 356

The Data Execution Prevention has nothing to do with blocked files that are just marked as blocked (see alternate data streams of NTFS). – Toro – 2010-02-18T10:14:19.050

-1

Sysinternals is good. You can get the source using web.archive.org, and let somebody develop the internet explorer context-menu for you on rentacoder.com

Quandary

Posted 2010-02-18T09:00:34.240

Reputation: 1 433

-1

Someone has written it but no x64 version available yet: http://www.benf.org/other/alternatestreamoverlay/index.html

Anonymous

Posted 2010-02-18T09:00:34.240

Reputation: 1

That extension adds an overlay icon whenever there is more than one ADS (which may not be the zone identifier one), but it doesn't provide an "Unblock" option in the context menu. There is a 64-bit version of it in the same page you link to too. – Xandy – 2012-11-05T10:13:12.050