07 February,2019 by Tom Collins
Question: I have a zip file , which I normally win-zip or unzip . I'd like to unzip an archive file as part of a Powershell script
Answer: You can use the Powershell cmdlet - Expand-Archive . I've also included some added bits around the ps cmdlet Expand-Archive , which will assist in managing access & file clean up .
# Unblock if there's a block – common problem
Unblock-File test.zip -ErrorAction SilentlyContinue
#the actual expand process
Expand-Archive -Path test.zip -DestinationPath e:\exsample\sql_server\modules -Force
#to remove your zip file
Remove-Item -Path test.zip
Read more on Powershell scripts
This is only a preview. Your comment has not yet been posted.
As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.
Having trouble reading this image? View an alternate.
Posted by: |