如何从蝙蝠完整路径解压文件名? [英] How to Extract the file name from a full path in bat?
本文介绍了如何从蝙蝠完整路径解压文件名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
一个变量%结果%
包含路径D:\\我的Folder1中\\我的文件夹2 \\我的文件夹3 \\重要FILE.TXT
。我想存储中的重要文件
在某些另一个变量。也就是说,我想从一个完整的路径中提取文件名(不含延伸)。
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.
推荐答案
这应该给你你所需要的。
This should give you what you need.
@echo off
for %%a in ("%result%") do set "newvariable=%%~na"
这篇关于如何从蝙蝠完整路径解压文件名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文