从CD%路径%获取目录名 [英] Get directory name from path of %CD%

查看:282
本文介绍了从CD%路径%获取目录名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

鉴于当前目录,%CD%

  C:\\父母\\子

在一个批处理文件,我怎么能在一个变量获取值儿童

感谢


解决方案

 为%%一中(这一点)设置currentfolder = %%〜呐
回声%currentfolder%

从这里开始:<一href=\"http://superuser.com/questions/160702/get-current-folder-name-by-a-dos-command\">http://superuser.com/questions/160702/get-current-folder-name-by-a-dos-command

Given that the current directory, %CD% is

C:\Parent\Child

In a batch file, how can I get the value Child in to a variable?

thanks

解决方案

for %%a in (.) do set currentfolder=%%~na
echo %currentfolder%

From here: http://superuser.com/questions/160702/get-current-folder-name-by-a-dos-command

这篇关于从CD%路径%获取目录名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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