Get filename from string-path?

前端 未结 3 1608
独厮守ぢ
独厮守ぢ 2020-12-29 02:37

How do I get the filename from this string?

\"C:\\Documents and Settings\\Usuario\\Escritorio\\hello\\test.txt\"

output:

\"         


        
3条回答
  •  余生分开走
    2020-12-29 02:48

    if your path comes as a parameter, just use:

    %~nx1 (1 is for the first param and we suppose it's the first one)

    echo %~nx1 would return directly test.txt

提交回复
热议问题