Differences

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

2016-04-29 2017-10-04
error: prefix (martin) using variable expansion in strings in powershell (martin)
Line 150: Line 150:
        if ($session.FileExists($remotePath))         if ($session.FileExists($remotePath))
        {         {
-            Write-Host ("File {0} exists" -f $remotePath)+            Write-Host "File $remotePath exists"
            # Now you can e.g. download file using session.GetFiles             # Now you can e.g. download file using session.GetFiles
Line 157: Line 157:
        else         else
        {         {
-            Write-Host ("File {0} does not exist" -f $remotePath)+            Write-Host "File $remotePath does not exist"
            exit 1             exit 1
        }         }
Line 169: Line 169:
catch [Exception] catch [Exception]
{ {
-    Write-Host ("Error: {0}" -f $_.Exception.Message)+    Write-Host "Error: $($_.Exception.Message)"
    exit 2     exit 2
} }

Last modified: by martin