Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I overwrite existing items with Folder.CopyHere in PowerShell?

Tags:

powershell

I run the following to unzip and want to overwrite the current files if they exist but the Microsoft solution doesn't seem to work. I haven't found anything that says it works so is there a work around to select the 'yes to all' option?

$zipPackage = (new-object -com shell.application).NameSpace($zipfilename) $destinationFolder = (new-object -com shell.application).NameSpace($destination) $destinationFolder.CopyHere($zipPackage.Items(),16) 
like image 839
Bruce227 Avatar asked Mar 01 '10 21:03

Bruce227


1 Answers

If you want it to overwrite AND be silent change 0x10 to 0x14 (docs).

$destinationFolder.CopyHere($zipPackage.Items(), 0x14)  
like image 180
Peter Avatar answered Oct 07 '22 01:10

Peter