powershell - extract file name and extension

前端 未结 9 896
温柔的废话
温柔的废话 2020-12-24 04:09

I need to extract file name and extension from e.g. my.file.xlsx. I don\'t know the name of file or extension and there may be more dots in the name, so I need to search the

9条回答
  •  庸人自扰
    2020-12-24 04:38

    PS C:\Windows\System32\WindowsPowerShell\v1.0>split-path "H:\Documents\devops\tp-mkt-SPD-38.4.10.msi" -leaf
    tp-mkt-SPD-38.4.10.msi
    
    PS C:\Windows\System32\WindowsPowerShell\v1.0> $psversiontable
    
    Name                           Value
    ----                           -----
    CLRVersion                     2.0.50727.5477
    BuildVersion                   6.1.7601.17514
    PSVersion                      2.0
    WSManStackVersion              2.0
    PSCompatibleVersions           {1.0, 2.0}
    SerializationVersion           1.1.0.1
    PSRemotingProtocolVersion      2.1
    

提交回复
热议问题