When we copy files (dll) from internet, Win7 blocks it. The unblock option appears as in the following image when we take the file properties. What command can I use to unblock the file from a batch file?
Asked
Active
Viewed 1.7k times
3 Answers
12
To do one is as per other suggestions. i.e either:
echo.>myDownloadedFile.dll:Zone.Identifier
or
Unblock-File myDownloadedFile.dll
but to do it 'bulk' as OP requested:
get-childitem *.jpg, *.gif | Unblock-File
or in DOS:
FOR %a in (*.jpg *.gif) do (echo.>%a:Zone.Identifier)

OzBob
- 4,227
- 1
- 39
- 48
-
2This bulk operation didn't work on Windows 10. I had to use double `%`. – akinuri Jan 08 '19 at 17:59
-
1@akinuri I tend towards Powershell solutions on Windows 10 – OzBob Feb 28 '19 at 06:31
11
Supposedly this should work:
echo.>myDownloadedFile.exe:Zone.Identifier
See a more detailed discussion here, Unblock a file with PowerShell?, which also describes other approaches using Powershell and the streams
tool from SysInternals.

Community
- 1
- 1

Nate Hekman
- 6,507
- 27
- 30
-
1For a filename with spaces in it, this works: `echo.>"myDownloadedFile.exe":Zone.Identifier` – nateirvin Apr 06 '18 at 15:27
-
-
`echo.` echoes nothing, and `>` outputs this nothing to the specified file. Or in this case, to the zone identifier of the file. – Nate Hekman Apr 06 '19 at 17:31
2
You can use streams -d path/to/file.zip This can be found here http://technet.microsoft.com/en-us/sysinternals/bb897440

Loïc MICHEL
- 24,935
- 9
- 74
- 103