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 151: Line 151:
        foreach ($fileInfo in $directory.Files)         foreach ($fileInfo in $directory.Files)
        {         {
-            Write-Host ("{0} with size {1}, permissions {2} and last modification at {3}" -f +            Write-Host ("$($fileInfo.Name) with size $($fileInfo.Length), " + 
-                $fileInfo.Name, $fileInfo.Length, $fileInfo.FilePermissions, $fileInfo.LastWriteTime)+                "permissions $($fileInfo.FilePermissions) and " + 
 +················"last modification at $($fileInfo.LastWriteTime)")
        }         }
    }     }
Line 165: Line 166:
catch [Exception] catch [Exception]
{ {
-    Write-Host ("Error: {0}" -f $_.Exception.Message)+    Write-Host "Error: $($_.Exception.Message)"
    exit 1     exit 1
} }

Last modified: by martin