问题
I'm working upon a PowerShell script, where I have to extract the content out of a .zip
archive which extension is removed, so, archive's name is let's say not test.zip
but just test
, and it is compressed as a .zip
archive.
I'm trying to use for this purpose the PowerShell cmdlet Expand-Archive
like shown below :
Expand-Archive -LiteralPath "Path to the archive" -DestinationPath "Extraction Path"
But, it doesn't seem to work, is there a possibility of extracting this archive's content with powershell, or it would be better to use a work around like 7zip command line tools, or something similar?
回答1:
The Expand-Archive
cmdlet is designed to explicitly work with a path that has a .zip
extension. You can work around this by either creating a copy of your archive with a proper extension using Copy-Item
or renaming the archive to have an extension with Rename-Item
(using Move-Item
may be more desirable if the archive with extension already exists and you want to overwrite it; Rename-Item
is not capable of overwriting).
来源:https://stackoverflow.com/questions/52725446/can-i-use-powershell-expand-archive-upon-a-zip-file-with-no-extension