我想拆分路径并将文件名 test.xls
保存在一个新变量中
$namearray = "C:\Users\z003m\Desktop\Service_Tickets\automationscript\vbs\Newfolder\test.xls"
最佳答案
推荐使用内置的 Split-Path
:
$newVariable = Split-Path $namearray -Leaf
关于powershell - 仅从文件的完整路径中获取文件名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44369465/