如何批量从完整路径中拆分文件名? [英] How to split the filename from a full path in batch?

查看:24
本文介绍了如何批量从完整路径中拆分文件名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在批处理脚本中将文件名从完整路径中分离出来?

How do I split the filename out of a full path in batch scripting?

推荐答案

@echo off
Set filename=C:Documents and SettingsAll UsersDesktopDostips.cmd
For %%A in ("%filename%") do (
    Set Folder=%%~dpA
    Set Name=%%~nxA
)
echo.Folder is: %Folder%
echo.Name is: %Name%

但我不能相信这一点;Google 在 http://www.dostips.com/forum 上找到了这个/viewtopic.php?f=3&t=409

But I can't take credit for this; Google found this at http://www.dostips.com/forum/viewtopic.php?f=3&t=409

这篇关于如何批量从完整路径中拆分文件名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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