powershell:scriptinscript
Script in Script ausführen
test-helloworld.ps1:
[CmdletBinding()] param ( [Parameter(Mandatory=$True)][String]$MyPar ) Write-Host "Hallo $MyPar!"
test-runscript.ps1:
param() $zzz = @{MyPar="Blubb"} $File = $Path + "test-helloworld.ps1" $ScriptFileData = Get-Content $File $ScriptData = @('param($zzz) &{') $ScriptData += $ScriptFileData $ScriptData += '} @zzz' $Script = [Scriptblock]::Create($ScriptData) Invoke-Command -ScriptBlock $Script -ArgumentList $zzz
powershell/scriptinscript.txt · Zuletzt geändert: 2018/01/02 17:31 von ronny