Tag: split
-
Split a filepath with PowerShell
This is a relatively short post as the process is simple but may be required in more complex scenarios. $dirArray = (“C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA”).Split(‘\’) foreach ($dir in $dirArray) { $dir } By calling the Split function we get a zero-based array ($dirArray) containing each element of the supplied string based on the delimiter (‘\’).…