Return variable value from second powershell script to first PowerShell script?
问题 I created 1.ps1 script which calls 2.ps1 script. After calling 2.ps1 it give some result in $variable . I want this $variable result to be used in my 1.ps1 for manipulation. $csv = Get-Content \\10.46.198.141\try\windowserver.csv foreach ($servername in $csv) { $TARGET = $servername $ProfileName = "CustomPowershell" $SCRIPT = "powershell.exe -ExecutionPolicy Bypass -File '\\10.46.198.141\try\disk_space.ps1' '$servername'" $HubRobotListPath = "C:\Users\Automation\Desktop\hubrobots.txt"