WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Miscellaneous

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Unblock a file

 Keywords: blocked unblock file download network alternate data stream 

Question:

When you run an executable directly from a network share or after IE downloads, the 'Open file - Security warning' dialog may appear. How do you prevent this prompt from appearing? In other words, how do you programatically unblock a file.

Answer:

"blocking" is simply an alternate data stream of the file, named "Zone.Identifier".

You can get rid of the warning cause by the zone stream in WinBatchwith FileDelete.

FileDelete(StrCat(strFile,":zone.identifier"))
Also when you download any update from the Internet that you plan to push to your client machines, strip the alternate data stream. You can do this for multiple files in multiple directories with:
streams.exe -d -s
http://technet.microsoft.com/en-us/sysinternals/bb897440.aspx


Background:

You can display the alternate data stream in CMD by using input redirection:
c:\temp> more < test.exe:Zone.Identifier[ZoneTransfer]ZoneId=3
You can locate them using dir /r on Windows Vista and later:
2009-10-24  12:18        54.538.056 test.exe                                 24 test.exe:Zone.Identifier:$DATA
Also in CMD you can easily get rid of that by overwriting it using output redirection:
echo.>myDownloadedFile.exe:Zone.Identifier
which isn't quite the same as removing the 'alternate data stream' completely, but works in that Explorer doesn't complain anymore.


See Also: Files Alternate Data Stream UDFs


Article ID:   W17981
Filename:   Unblock a file.txt
File Created: 2014:07:18:09:51:38
Last Updated: 2014:07:18:09:51:38