Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Batch file to unblock files copied from internet

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?

enter image description here

like image 885
Maanu Avatar asked Mar 07 '13 05:03

Maanu


People also ask

How do I unblock files downloaded from the Internet?

Press Ctrl+A to select all the folders. Right click on any folder and click Properties. b. Click Unblock button present under the General tab.

How do I unblock multiple files in Windows?

You can check the box (in Windows 10) or click the Unblock button (in Windows 7/8) to unblock the file. However, if you have multiple files, you cannot select more than one and view the properties to unblock all of the files at once. Instead, you will have to check each file separately and unblock them one at a time.

What does %1 mean in a batch file?

When used in a command line, script, or batch file, %1 is used to represent a variable or matched string. For example, in a Microsoft batch file, %1 can print what is entered after the batch file name.


2 Answers

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.

like image 80
Nate Hekman Avatar answered Sep 24 '22 22:09

Nate Hekman


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)
like image 27
OzBob Avatar answered Sep 25 '22 22:09

OzBob