"This file came from another computer..." - how can I unblock all the files in a folder without having to unblock them individually?

189

64

Windows XP SP2 and Windows Vista have this deal where zone information is preserved in downloaded files to NTFS partitions, such that it blocks certain files in certain applications until you "unblock" the files.

So for example if you download a zip file of source code to try something out, every file will display this in the security settings of the file properties

"This file came from another computer and might be blocked to help protect this computer"

Along with an "Unblock" button. Some programs don't care, but Visual Studio will refuse to load projects in solutions until they've been unblocked.

While it's not terribly difficult to go to every project file and unblock it individually, it's a pain. And it does not appear you can unblock multiple selected files simultaneously.

Is there any way to unblock all files in a directory without having to go to them all individually?

I know you can turn this off globally for all new files but let's say I don't want to do that

Tom Kidd

Posted 2009-09-09T15:23:43.127

Reputation: 1 607

3My downloads in Google Chrome get tagged and I have to unblock them. @jamiebarrow has the right information for disabling this globally via the registry, or you can use the Local Group Policy Editor (gpedit.msc) and change the setting in User Configuration > Administrative Templates > Windows Components > Attachment Manager > Do not preserve zone information in file attachments > Enabled. – Baodad – 2014-07-22T16:20:31.940

The solution is obtaining a EV (extra validation) Code Signing Certificate and signing your executable. For example: https://www.digicert.com/code-signing/ev-code-signing.htm

– Michael Haephrati – 2015-05-18T09:41:53.063

Third worst windows feature. The worst is focus grabbing by applications, taking the input you intended for another program and acting upon it before you know. – foo – 2019-08-08T20:52:32.460

30How does one turn this off globally? Link please? :) Thanks – underskor – 2009-10-05T01:46:11.590

6

@Thomas As one of the answers points out, you can do this by setting the registry key HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Attachments\SaveZoneInformation = 1. More info: http://support.microsoft.com/kb/883260

– jamiebarrow – 2013-01-10T22:28:19.637

19Yes, worst Windows "feature" ever... – Brian Knoblauch – 2009-10-29T11:41:19.123

16Second worst. The first worst is auto-run on newfound media, which is what started this mess. – kmarsh – 2009-10-29T11:47:26.380

@jamiebarrow: I cant the key on Windows 8.1. Any alternate solution for globally turning off the thing? – tumchaaditya – 2014-01-13T06:20:15.893

Schnapple - Perhaps this question should be tagged with [tag:Internet-Explorer], as up until recently (as far as I am aware) this is the only browser that tags it's downloaded files in this manner. ALL - On the page http://support.microsoft.com/kb/883260 that jamiebarrow provided above, the relevant section is titled "Do not preserve zone information in file attachments" (Annoying that MS doesn't use uniquely ID'd elements, to make # referencing easier). @tumchaaditya..Try creating all missing keys

– user66001 – 2014-05-11T20:28:12.570

Answers

185

If you download a .ZIP and unzip it, the individual files will be marked as the same zone as the .ZIP. Almost every time I have a folder full of "blocked" files, this is how I got them.

Before unzipping, click the Unblock button on the .ZIP.

Jay Bazuzi

Posted 2009-09-09T15:23:43.127

Reputation: 3 780

@Charlie you can still zip up the modified files, unblock and then unzip – seanjacob – 2014-08-22T14:34:12.147

Is there anyway to reset this zone information once the file is unblocked? Once I unblock the file I don't see anything in file properties with the help of which I can undo this action? – RBT – 2016-09-13T05:15:47.217

If the .zip is marked as Read-Only, clicking the "Unblock" button WILL NOT WORK! To fix it: Uncheck the "Read Only" attribute, Unblock it, then re-check the "Read Only" attribute box again. – Gabriel Staples – 2017-09-29T14:35:04.460

3Actually, no. I download zip-files to use the content and I let my browser open the zip file automatically. From there I invoke "Extract all files". There is no option to unblock from these location, and hunting down the zip file in the download folder or even worse, the temp folder, is very tedious. – Thomas Eyde – 2010-09-16T11:29:33.610

I wish I could upvote this more than once. – dave thieben – 2011-06-01T19:57:51.830

1This one's definitely the easiest - you win – Tom Kidd – 2009-09-09T16:03:15.327

+1 same conclusion I came to - an easy way to package files in a non-NTFS manner - found this by searching Google for these terms: unblock all files in a directory xp. – Will Bickford – 2009-09-09T18:19:00.543

This solution only works if you haven't modified the files that came out of the ZIP file. – Charlie – 2013-09-04T19:11:12.187

@ThomasEyde - I wonder if the below answer may be halfway towards a way to get Explorer to run the streams program against the ZIP, before launching the Explorer unzipper ¿DLL?

– user66001 – 2014-05-11T20:56:51.767

94

PowerShell, available here, has an Unblock-File cmdlet that will do this task for you. To unblock all of the files in a directory, you'd issue the following command.

dir c:\mydir -Recurse | Unblock-File

Unblock-File doc

pk.

Posted 2009-09-09T15:23:43.127

Reputation: 410

3This worked for me but didn't provide any feedback at the cmd line. I also tweaked it slightly, if you're already in the folder then you can just do dir -Recurse | Unblock-File – user36088 – 2014-09-12T02:44:56.450

+1 for not needing to unzip again.. made change to some files already – Jony Adamit – 2015-02-15T13:16:47.103

3Works like a champ. This should be the accepted answer. – Chuck Conway – 2015-02-19T07:25:01.047

Unreliable for me on Windows 7 SP1 x64. Works for some directories, but not for others and I can't figure out why. No error, the data stream just remains sometimes. – EM0 – 2015-03-10T17:54:48.097

1Perfect. This should be the accepted answer. Unblocking the zip is fine and dandy if you remember it, but this method for doing it for a bunch of files all at once is great. – Bas – 2017-05-11T11:20:42.803

2No longer just Beta, this is released and works quite well. – Ken Hiatt – 2013-07-13T20:12:14.423

Excellent! I extracted a big zip and forgot to unblock it first, then deleted the zip to save space. This saved me downloading it again or a load of manual work :) – Danny Tuppeny – 2014-06-01T12:49:06.140

65

It's quite simple, NTFS attached a data stream (that IDs "unsafe files") to the file when it is just downloaded from the Internet.

Do recursively remove this stream for all files, follow these steps :

  1. Download the Streams CLI executable from Microsoft
  2. Put the streams.exe executable in your Windows directory (or anywhere that the system can find it)
  3. Run this line in the command line :

streams -s -d directory

It will then remove all of the data streams from all files recursively in the directory - you have now successfully unblocked all files.

caliban

Posted 2009-09-09T15:23:43.127

Reputation: 18 979

If you do this programmatically, add the registry key that accepts the eula, then the User isn't prompted: [HKEY_CURRENT_USER\Software\Sysinternals\Streams] "EulaAccepted"=dword:00000001 – Quandary – 2015-01-08T10:14:17.970

I had some files in my Windows 8.1 OneDrive folder and was sceptical of this approach. Running streams.exe shows a LOT of other alternate data streams for such files. The Powershell answer below is ideal as it leaves the other alternate data streams, such as those wanted by the OneDrive sync client, alone. – Ian Yates – 2015-06-22T06:14:11.017

This method didn't work for me anyway - it just said that it couldn't find any files with streams (even though I had the option to "Unblock" several files in their Properties screen and AlternateStreamView saw the streams). – Pat – 2010-08-31T16:38:49.617

1Worked a charm for me. – Paul Suart – 2011-09-25T21:11:13.560

9Might be dangerous. Windows also uses streams for other purposes. – harrymc – 2009-09-09T15:41:34.027

6Very rare - data streams are hardly used for anything since it's an undocumented feature. It will be safe if as schnapple has said - he just wants to unblock files in a certain directory that are known to be documents received over the internet. At no point in time am I recommending him to do streams -s -d C:\ :) – caliban – 2009-09-09T15:46:03.613

6just checked (since Streams is an undocumented feature it's hard to verify though) with some people, and they believe that once a document is transferred over the Internet or go through anything other than NTFS, it loses all stream data. As a result, when you first download something from the Internet, the only data stream you will have is that "Unsafe File" data stream. – caliban – 2009-09-09T15:54:59.880

22

Why do you think they're not documented? (http://msdn.microsoft.com/en-us/library/aa364404(VS.85).aspx)

– Reuben – 2009-09-09T16:12:36.007

2While this will work, just to say that Office 2007 documents use streams and that file properties are stored as streams. I suggest using "streams -d" carefully. – harrymc – 2009-09-09T16:13:25.103

1@caliban: That's not entirely right. WinRAR offers the ability to save file streams when archiving and this preserves the data streams for archived files. You only lose them when you extract .RAR files onto a file system that doesn't support file streams. – Alex Essilfie – 2012-01-09T12:35:27.320

2It's not NTFS that attaches the source zone. It's the browser or Explorer when downloading/copying a file. The file system couldn't care less. – Joey – 2012-11-10T15:12:15.763

mine says "No files with streams found." and the problem persists – None – 2013-04-27T13:10:09.110

6Don't blindly delete all alternate data streams, unless you have backup copies of those NTFS encrypted files. – Ian Boyd – 2009-12-15T20:51:55.883

@AlexEssilfie + harrymc + Ian Boyd - Assuming you are not in the situation of Thomas Eyde outlined in his comment in another answer, and that you only run any stream removing method on the immediate files downloaded from the internet via IE (something I think caliban should make cleaer in this answer)... not the result of uncompressing that/those immediate files, can't see how you won't just remove the ":Zone.Identifier:$DATA" streams set by IE, which is the requirement of this question.

– user66001 – 2014-05-11T20:49:28.410

31

AlternateStreamView can list all alternate NTFS streams for files in a directory (and sub-directories if desired).

Delete all streams marked ":Zone.Identifier:$DATA" for the selected files to get rid of the security blocks.

enter image description here

Snark

Posted 2009-09-09T15:23:43.127

Reputation: 30 147

1

There's another tool for this exact purpose - ZoneIDTrimmer

– itsho – 2014-03-03T07:08:45.960

@ZoneIDTrimmer - Not sure I understand. What other tool? – user66001 – 2014-05-11T20:36:36.973

6ZoneIDTrimmer is the name of the tool, not the alias of the person. – Snark – 2014-05-11T21:13:16.487

12

A very easy workaround for this kinda ties into the first answer, say if you have around 1000 files that are all blocked just take all the files, and put them in a new folder on your desktop (or whatever folder directory you're working in them right click said folder and then click Send To and then out of the options Click Compressed (zipped) Folder, then after that delete your original files and extract the .ZIP folder and Viola!!! all your files are unblocked :D, worked for me on XP Pro SP3, so kinda assuming it will work on vista as well

Kristian

Posted 2009-09-09T15:23:43.127

Reputation: 61

By far the least amount of work. Nice! – RomanSt – 2015-11-09T14:53:06.900

9

To disable blocking when files are downloaded, open the following registry key:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Attachments\SaveZoneInformation

Change SaveZoneInformation to 1.

NOTE:

  • 0 = Not Configured
  • 1 = Enabled
  • 2 = Disabled

user61000

Posted 2009-09-09T15:23:43.127

Reputation: 31

Requires admin rights :( – Quandary – 2015-01-08T10:11:11.653

Just set this via the appropriate group policy (which I then confirmed set this registry key). Thanks :) – Ian Yates – 2015-06-22T06:12:24.067

1

This works in Windows 7 and 8 as well (and likely 10). Updated link: https://support.microsoft.com/en-us/kb/883260. This also affects Chrome and I think Firefox.

– thaimin – 2015-08-15T19:39:29.923

2I don't have that option on windows 7 and article only mentions XP. Still, looks interesting. – AndrejaKo – 2010-12-31T11:41:54.430

Can you add the key to enable / disable? Just because you don't have a User Policy key only means that it hasn't been set up that way; you can still use it. – JohnZaj – 2011-06-13T11:22:51.307

@user61000 - Am I right in my suspicion this only alters IE's behaviour, and not (as I found out is now done with the latest release of) Firefox (or other) browsers? – user66001 – 2014-05-11T19:55:30.393

8

As another poster said the insecure file flag is stored in an NTFS data stream. What this means is there's a very easy way to remove this data stream, just move the file to a drive that doesn't support NTFS data streams.

Assuming that your problem is more related to the number of files, rather than the size of them, then the easiest way to do it might be to move (not copy) the files to a FAT formatted drive, then move them back to the NTFS drive (almost every USB stick is formatted FAT32 so will do nicely), and then move those files back to where you want them.

I've done this before when I've wanted to strip the blocked flag from a whole directory of downloaded files and it did exactly what I needed.

GAThrawn

Posted 2009-09-09T15:23:43.127

Reputation: 4 176

7

  • Download the Sysinternals Streams utility.
  • Unzip and copy streams.exe to \Windows\System32.
  • Create a new text file and rename it to something like "unblocker.reg".
  • Copy the below registry script in it:

    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\*\shell\unblockfile]
    @="Unblock file"
    
    [HKEY_CLASSES_ROOT\*\shell\unblockfile\command]
    @="cmd /c streams -d \"%1\""
    
    [HKEY_CLASSES_ROOT\Directory\shell\unblockallthefiles]
    @="Unblock the files inside"
    
    [HKEY_CLASSES_ROOT\Directory\shell\unblockallthefiles\command]
    @="cmd /c streams.exe -d -s \"%1\""
    
  • Save the file.

  • Double-click the saved file to merge it into the registry.

After this, whenever you right-click a file, you can select "Unblock file" in the context menu or you can right-click a folder and select "Unblock files in here".

source

creapure90

Posted 2009-09-09T15:23:43.127

Reputation: 41

It worked for me, after I added the path to streams.exe in the 8.3 format: @="cmd /c C:\PROGRA~2\Sysinternals\streams.exe -d -s \"%1\"" – Olivier Jacot-Descombes – 2014-09-27T16:21:05.980

I know this is an old thread but thanks. There are multiple versions of the same reg script on the internet and most of them don't work. I can add that this worked for me on Windows 7 professional 64bit. – trenten – 2016-07-28T18:28:23.380

+1 Great idea to make this process less time intensive. – user66001 – 2014-05-11T19:56:19.570

5

AlternateStreamView is great. Another method though is to archive the files to .RAR, 7z or .ZIP . Delete the originals and then re-extract the files.

Alec

Posted 2009-09-09T15:23:43.127

Reputation:

2

I had the same issue and the way I unblocked the files was:

  • I added all the blocked files to a RAR archive (I used WinRAR)
  • I removed the original files
  • I extracted all the files from the archive

All the files are now unblocked.

For me it was some MSDN Magazine issues that were in .chm format, but I do not think the file type matters.

leoinfo

Posted 2009-09-09T15:23:43.127

Reputation: 81

1

I was searching for a batch method (without using powershell) and after reading this post I came up with this simple solution

echo. > .\filename.zip:Zone.Identifier

this will not remove the Zone.Identifier data stream but clear it's content which seems to work fine.

Another solution (which will clear all data streams and use a temporary file is this)

type filename.zip > filename.zip.tmp
move /y filename.zip.tmp filename.zip

Jürgen Steinblock

Posted 2009-09-09T15:23:43.127

Reputation: 318

1

ZoneIDTrimmer looks like the most user-friendly tool available for this:

enter image description here

RomanSt

Posted 2009-09-09T15:23:43.127

Reputation: 7 830

0

I have a usb external Hard Drive that works great for removing the blocks... I made a small partition and formatted it in FAT32..when I want to remove the block from something I simply move it to that drive and then move it back :-)

user200075

Posted 2009-09-09T15:23:43.127

Reputation: 11

This is certainly a good approach, but it has already been mentioned in GAThrawn's answer.

– Dennis – 2013-02-18T03:54:00.383

Possibly the least risky/step intensive out of the workaround answers provided. – user66001 – 2014-05-11T19:58:35.823

-4

Yes. At a command prompt, takeown /f <name of file>.

In your case, takeown /f *.* /r to recurse into all sub-directories and unblock *.*. Play with the pattern if necessary.

takeown /? for more usage instructions.

Peter Mounce

Posted 2009-09-09T15:23:43.127

Reputation: 668

1How shall that help? – Werner Henze – 2014-01-22T10:28:24.777

-5

There is another easy way. Just select the file or the folder, right click it and select Properties⇨Security⇨Edit, then click on Full Control.

After that you should just click [Save] and exit.

shreyas

Posted 2009-09-09T15:23:43.127

Reputation: 1

2This is not the place where Windows stores the information that the file comes from another computer. – Werner Henze – 2014-01-22T10:30:02.677

Agree Werner Henze. Pity, though - like shreyas 's effort with the unicode arrows.

– user66001 – 2014-05-11T20:22:31.280