[英]getting filename part of a path in windows batch script
In a batch script, I have a batch var %filePath% that has the path to a file. 在批处理脚本中,我有一个批处理var%filePath%,它具有文件的路径。 If I want to extract just the filename part from it, what is the command for that? 如果我只想从中提取文件名部分,那么命令是什么?
Thanks! 谢谢!
try this: 尝试这个:
for /f "delims=" %%i in ("%filePath%") do set "fileName=%%~nxi"
echo %fileName%
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.