.Zip Extract to SharePoint error.

it is throwing an error when i select and save extracted file in sharepoint path(Locally). same works fine when i use my local system path

$7ZipPath = ‘”C:\Program Files\7-Zip\7z.exe”‘

$FileBrowser = New-Object System.Windows.Forms.OpenFileDialog -Property @{
    Filter = ‘Zip files (*.zip)|*.Zip|All files (*.*)|*.*’
    Title  = ‘Select the Zip file file’
$FileSelected = $FileBrowser.ShowDialog()

if ($FileSelected -ne ‘OK’) {
    Write-Host “File not selected” -ForegroundColor Red
else {
    $ZipFile = $FileBrowser.Filename
    Write-Host “file $ZipFile”

$ZipFilePassword = Read-Host “Please enter the Password” -AsSecureString
$SelectFolder = New-Object System.Windows.Forms.FolderBrowserDialog -Property @{
    Description = “Select a destination folder”

if ($SelectFolder.ShowDialog() -ne “OK”) {
    Write-Host “Destination folder is not selected” -ForegroundColor Red
else {
    $OutFolder = $SelectFolder.SelectedPath

$BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($ZipFilePassword)

$PlainTextPassword = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)

$Command = “& $7ZipPath e -o$OutFolder -y -tzip -p$PlainTextPassword ‘$ZipFile'”

Invoke-Expression -Command $Command

Error: Below

7z.exe :
At line:1 char:1
+ & “C:\Program Files\7-Zip\7z.exe” e -oC:\Users\…
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
Command Line Error:
Unknown switch:

Got the issues resolved after modify this line added single coated semi colon.


$Command = “& $7ZipPath e -‘o$OutFolder’ -y -tzip -p$PlainTextPassword ‘$ZipFile’”