Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Using a batch file to execute .ps1 files in other directories in order

$
0
0

What i have is this batch file that I would like to adapt.  I am new to PS.

IN G:\MyDirectory\Test

StartFile.bat
cd /d %~dp0
powershell.exe -File sp_script.ps1
pause

IN G:\MyDirectory\Test\Build_01\sp_script.ps1
 .sql files it executes

IN G:\MyDirectory\Test\Build_02\sp_script.ps1
 .sql files it executes

I need to execute each build folder in order. 

If the batch file, the .ps1 file and the sql files are all in the same directory it works great.  I would like to have a batch file that executes each one of the build folders in order.

 

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles