Last active
August 29, 2015 14:24
-
-
Save mkesper/357595053ace2ca6acc2 to your computer and use it in GitHub Desktop.
Powershell Invoke-Expression Parameter Trouble
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set-StrictMode -Version "2.0" | |
function ProcessContent{ | |
$FileName = Join-Path "C:\PATH\IN" ("{0}.JSON" -f $PlannedChanges.Anforderung.Changenummer) | |
$PlannedChanges|ConvertTo-Json -Compress|Out-File -Encoding utf8 $FileName | |
Invoke-Expression "C:\PATH\Skript\MoveHome.ps1 -changenummer $PlannedChanges.Anforderung.Changenummer" | |
} | |
Get-ChildItem "C:\PATH\IN" -Filter *.TXT | Where-Object{$_.FullName -ne $null} |` | |
ForEach-Object{ | |
ProcessContent | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param([string]$changenummer = "") | |
Set-StrictMode -Version "2.0" | |
Write-Output ("MoveHome - Processing: {0}" -f $Changenummer) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Seems everything is ok after putting script and parameters in quotes but I got caught by "throw" messing up different contexts.