Executing another Powershell script
To execute another ps file, just type the ps file name.
Write-Output "Running test1.ps...."
Write-Output ""
# method #1 - run the hardcoded script file
#
# .\test1.ps1
#
# method #2 - run the script file name stored in a variable.
$ps_file = "$PSScriptRoot\test1.ps1"
& $ps_file
Write-Output "Running test1.ps...."
Write-Output ""
# method #1 - run the hardcoded script file
#
# .\test1.ps1
#
# method #2 - run the script file name stored in a variable.
$ps_file = "$PSScriptRoot\test1.ps1"
& $ps_file
Comments
Post a Comment