Skip to content

Instantly share code, notes, and snippets.

@mitaken
Created February 12, 2018 14:19
Show Gist options
  • Save mitaken/b464928bb30f76bae4a0801f38f2ce09 to your computer and use it in GitHub Desktop.
Save mitaken/b464928bb30f76bae4a0801f38f2ce09 to your computer and use it in GitHub Desktop.
Drag and Drop zone protected files
Option Explicit
Call WScript.Quit(Main())
Function Main()
Dim ObjShell, ObjResult, ObjStdIn
Set ObjShell = WScript.CreateObject("WScript.Shell")
Set ObjResult = ObjShell.Exec("powershell -NoLogo -Command -")
Set ObjStdIn = ObjResult.StdIn
Dim ObjArgs, StrArgs, StrCmd
Set ObjArgs = WScript.Arguments
For Each StrArgs In ObjArgs
StrCmd = "Unblock-File -LiteralPath """ & StrArgs & """"
Call Debug.WriteLine(StrCmd)
Call ObjStdIn.WriteLine(StrCmd)
Next
Set ObjArgs = Nothing
Call ObjStdIn.Close()
Set ObjStdIn = Nothing
Main = ObjResult.ExitCode
Set ObjResult = Nothing
Set ObjShell = Nothing
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment