Differences

This shows you the differences between the selected revisions of the page.

2017-07-23 2017-10-04
deduplicate accelerators (martin) using variable expansion in strings in powershell (martin)
Line 63: Line 63:
    }     }
-    Write-Host ("Archiving {0} files to archive {1}..." -f $localPaths.Count, $archiveName)+    Write-Host "Archiving $($localPaths.Count) files to archive $archiveName..."
       
    $archivePath = Join-Path ([System.IO.Path]::GetTempPath()) $archiveName     $archivePath = Join-Path ([System.IO.Path]::GetTempPath()) $archiveName
Line 113: Line 113:
            {             {
                $entryName = $file.Replace(($parentPath + "\"), "")                 $entryName = $file.Replace(($parentPath + "\"), "")
-                Write-Host ("Adding {0}..." -f $entryName)+                Write-Host "Adding $entryName..."
                [System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile($zip, $file, $entryName) | Out-Null                 [System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile($zip, $file, $entryName) | Out-Null
            }             }
Line 121: Line 121:
    }     }
-    Write-Host ("Archive {0} created, uploading..." -f $archiveName)+    Write-Host "Archive $archiveName created, uploading..."
    # Load WinSCP .NET assembly     # Load WinSCP .NET assembly
Line 142: Line 142:
        $session.PutFiles($session.EscapeFileMask($archivePath), $remotePath).Check()         $session.PutFiles($session.EscapeFileMask($archivePath), $remotePath).Check()
-        Write-Host ("Archive {0} uploaded." -f $archiveName)+        Write-Host "Archive $archiveName uploaded."
        & "$env:WINSCP_PATH\WinSCP.exe" "$sessionUrl" /refresh "$remotePath"         & "$env:WINSCP_PATH\WinSCP.exe" "$sessionUrl" /refresh "$remotePath"
Line 157: Line 157:
catch [Exception] catch [Exception]
{ {
-    Write-Host ("Error: {0}" -f $_.Exception.Message)+    Write-Host "Error: $_.Exception.Message"
    $result = 1     $result = 1
} }

Last modified: by martin