Author Posts

January 1, 2012 at 12:00 am

by scifidad71 at 2012-12-18 14:55:19

Hello, I used the below Powershell script to unzip a folder and subfolders:

$shell_app=new-object -com shell.application
$filename = "Test.zip"
$zip_file = $shell_app.namespace((Get-Location).Path + "\$filename")
$destination = $shell_app.namespace((Get-Location).Path)
$destination.Copyhere($zip_file.items(), 0x10)

Where 0x10 is overwrite files, 0x4 is ignore dialog prompt, and 0x14 does both – overwrite and ignore the dialog box.
The command works great except it still prompts if I use any of the above examples??? I need to bypass any dialog prompts and just overwrite all files and folders.

by DonJ at 2012-12-20 06:45:54

You're using an external COM object, there, and its behavior is hardcoded internally. It's possible it isn't interpreting your 0x10 properly, or that you've got the wrong value. Unfortunately, I'm not familiar enough with that COM object to tell you which it is, but it isn't a PowerShell issue per se – PowerShell's just passing stuff off to COM, which has to go through .NET interop. There's a lot of layers in which something can get lost.