Question:
I want to split the path and just save the file name test.xls
in a new variable
1 2 |
$namearray = "C:\Users\z003m\Desktop\Service_Tickets\automationscript\vbs\Newfolder\test.xls" |
Answer:
Recommend using the built-in Split-Path
:
1 2 |
$newVariable = Split-Path $namearray -Leaf |