Get the file name from a full or relative path knowing that this one is not a parameter of the batch

前端 未结 1 449
难免孤独
难免孤独 2021-01-29 09:42

When a file, along with relative path or full path..., is given as a parameter of a batch, I know how to expand %1 to get the file name

    %~n1 
相关标签:
1条回答
  • 2021-01-29 10:29
    ...
     echo %%~nx
     set filetxt=%%~nx)
    

    should cure your problem.

    or use ~nxx if you want the extension too.

    0 讨论(0)
提交回复
热议问题