scripting – Run Multiple Powershell Scripts Sequentially – on a Folder – Combine Scripts into a Master Script – Stack Overflow
Posted by jpluimers on 2019/07/30
Cool tip by mjolinor to execute the scripts 1.ps1
, 2.ps1
and 3.ps1
from a master.ps1
script in the same directory:
&"$PSScriptroot\1.ps1"
&"$PSScriptroot\2.ps1"
&"$PSScriptroot\3.ps1"
Source: [WayBack] scripting – Run Multiple Powershell Scripts Sequentially – on a Folder – Combine Scripts into a Master Script – Stack Overflow.
It uses $PSScriptroot
which got introduced in PowerShell 2 in modules and extended in PowerShell 3 to be available in all scripts. More information in [WayBack] about_Automatic_Variables | Microsoft Docs
–jeroen
Leave a comment