Get filename from string-path?

前端 未结 3 1596
独厮守ぢ
独厮守ぢ 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 03:02

    Method 1

    for %%F in ("C:\Documents and Settings\Usuario\Escritorio\hello\test.txt") do echo %%~nxF
    

    Type HELP FOR for more info.

    Method 2

    call :sub "C:\Documents and Settings\Usuario\Escritorio\hello\test.txt"
    exit /b
    
    :sub
    echo %~nx1
    exit /b
    

    Type HELP CALL for more info.

提交回复
热议问题