得到的字符串路径文件名? [英] Get filename from string-path?

查看:108
本文介绍了得到的字符串路径文件名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何从这个字符串得到的文件名?

How do I get the filename from this string?

"C:\Documents and Settings\Usuario\Escritorio\hello\test.txt"

输出:

"test.txt"

我真的试图找到这一个发​​布前,但所有被污染的结果,只讲从当前目录下的文件名得到(我必须处理字符串只)

I really tried to find this one before posting, but all the results were contaminated, they talk about getting filenames from current dir (I must work with strings only)

推荐答案

方法1

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

键入的帮助了解更多信息。

方法2

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

:sub
echo %~nx1
exit /b

键入 HELP CALL 了解更多信息。

这篇关于得到的字符串路径文件名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆