Get only filename from full path of a file

后端 未结 2 833
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-21 09:39

I want to split the path and just save the file name test.xls in a new variable

$namearray = \"C:\\Users\\z003m\\Desktop\\Service_Tickets\\automatio         


        
2条回答
  •  有刺的猬
    2021-01-21 10:15

    Recommend using the built-in Split-Path:

    $newVariable = Split-Path $namearray -Leaf
    

提交回复
热议问题