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