How to Extract the file name from a full path in b

2019-06-05 05:27发布

A variable %result% contains the path "D:\My Folder1\My Folder 2\My Folder 3\The Important File.txt" . I want to store The Important File in some another variable. That is, I want to extract the file name (Without extention) from a full path.

2条回答
我想做一个坏孩纸
2楼-- · 2019-06-05 06:12

This should give you what you need.

@echo off
for %%a in ("%result%") do set "newvariable=%%~na"
查看更多
登录 后发表回答