title: powershell add file to zip
body: <p>I'm trying to add a file to a zip file using powershell</p>
  
  <p>I can create the zip file but can't work out how to add my file to it</p>
  
  <p>I'm using</p>
  
  <pre><code>$zipfilename = 'c:\cwRsync\backup.zip'
  $file = 'c:\cwRsync\backup.log'
  set-content $zipfilename ("PK" + [char]5 + [char]6 + ("$([char]0)" * 18))
  (dir $zipfilename).IsReadOnly = $false
  $zipfile = (New-Object -ComObject shell.application).NameSpace($zipfilename)
  $zipfile.MoveHere($file.FullName)
  </code></pre>
  
  <p>This create the zip file but doesn't add the new file</p>
  
  <p>I tried the following code I found on stackoverflow which works</p>
  
  <pre><code>$zipfilename = "a.zip"
  set-content $zipfilename ("PK" + [char]5 + [char]6 + ("$([char]0)" * 18))
  $app = new-object -com shell.application
  $zip = ( get-item a.zip ).fullname
  $folder = $app.namespace( $zip )
  $item = new-item file.txt -itemtype file -value "Mooo" -force
  $folder.copyhere( $item.fullname )
  </code></pre>
  
  <p>but that add a file created by powershell whereas I want to add an existing file</p>
  
  <p>Any help would be much appreciated</p>