【问题标题】:getting filename part of a path in windows batch script在 Windows 批处理脚本中获取路径的文件名部分
【发布时间】:2013-05-06 23:23:22
【问题描述】:

在批处理脚本中,我有一个包含文件路径的批处理 var %filePath%。如果我只想从中提取文件名部分,那么命令是什么?

谢谢!

【问题讨论】:

    标签: windows for-loop batch-file cmd directory


    【解决方案1】:

    试试这个:

     for /f "delims=" %%i in ("%filePath%") do set "fileName=%%~nxi"
     echo %fileName%
    

    【讨论】:

      猜你喜欢
      • 2011-04-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-21
      • 2011-02-05
      • 2016-05-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多