0

I have about 100 large RAR files in the same folder, and I'm trying to delete a particular filespec from within each archive. I'm using PowerShell 2.0 on Windows Storage Server 2008 R2.

I'm by no means a PowerShell user, here's what I came up with so far:

$files=get-childitem .
foreach($filename in $files) { 
  & 'C:\Program Files\WinRAR\WinRAR.exe' D $filename *-old.bak
}

I think something like this will do the trick, but it is spawning simultaneous copies of WinRAR, which basically hangs everything up.

How can I tell PowerShell (or WinRAR) to wait until one file's processing is complete before moving to the next one?

2

Use the Start-Process Commandlet with the -Wait option enabled. You might have to shove in your parameters through the -ArgumentList Option for them to work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.