Skip to content
This repository has been archived by the owner on Jul 18, 2024. It is now read-only.

Expand-Archive: A parameter cannot be found that matches parameter name 'DestinationPath' #52

Closed
gmahender opened this issue Jan 6, 2018 · 5 comments

Comments

@gmahender
Copy link

gmahender commented Jan 6, 2018

When expanding zip file with -DestinationPath parameter, cmdlet is throwing error - see below for detailed error message.
My environment is Windows 10 x64 (build 16299).

F:\1> Expand-Archive -Path abc.zip -DestinationPath f:\1\temp
Expand-Archive : A parameter cannot be found that matches parameter name 'DestinationPath'.
At line:1 char:32
+ Expand-Archive -Path .\abc.zip -DestinationPath f:\1\temp
+                                ~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Expand-Archive], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Pscx.Commands.IO.Compression.ExpandArchiveCommand
F:\1> Expand-Archive -LiteralPath f:\1\abc.zip -DestinationPath f:\1\temp
Expand-Archive : A parameter cannot be found that matches parameter name 'DestinationPath'.
At line:1 char:42
+ Expand-Archive -LiteralPath f:\1\abc.zip -DestinationPath f:\1\temp
+                                          ~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Expand-Archive], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Pscx.Commands.IO.Compression.ExpandArchiveCommand
@anmenaga
Copy link
Collaborator

anmenaga commented Jan 6, 2018

@gmahender Looks like you are running Expand-Archive cmdlet from Pscx module, not from Microsoft.PowerShell.Archive module.

@gmahender
Copy link
Author

Thanks for catching my silly mistake.
I was able to unzip with -outputpath parameter.

Expand-Archive -Path .\abc.zip -OutputPath f:\1

@tomer-ds
Copy link

I have run into the same issue.
This is a bit of an annoyance because on some systems Microsoft.PowerShell.Archive is used and DestinationPath works, but in other systems Pscx module is used and OutputPath works.

I need a way to standardize which module is used so my code doesn't have to take into account both.
Is there any way I can specify that my cmdlet use Microsoft.PowerShell.Archive instead of Pscx?

@megamorf
Copy link

@tomerMP You can call a function from a specific module by prepending it with the module name.

So Expand-Archive -DestinationPath
becomes
Microsoft.PowerShell.Archive\Expand-Archive -DestinationPath

@tomer-ds
Copy link

@megamorf , Thanks a ton!!! Solved my issue

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants