获取DOS路径而不是Windows路径 [英] Get DOS path instead of Windows path
问题描述
在DOS窗口中,如何获取我所在目录的完整DOS名称/短名称?
In a DOS window, how can I get the full DOS name/short name of the directory I am in?
例如,如果我在目录中 C:\程序文件\Java\jdk1.6.0_22
,我要显示它的简称 C:\PROGRA〜1\ \Java\JDK16〜1.0_2
。
For example, if I am in the directory C:\Program Files\Java\jdk1.6.0_22
, I want to display it's short name C:\PROGRA~1\Java\JDK16~1.0_2
.
我知道运行 dir / x
会给我当前目录中文件/目录的简称,但是我一直无法找到一种以短名称格式显示当前目录的完整路径的方法。我必须逐个遍历从根到目录的路径,每个都运行 dir / x
。
I know running dir /x
will give me the short names of files/directories in the current directory but I haven't been able to find a way to display the full path of the current directory in short name format. I'm having to work my way through the path from the root, directory by directory, running dir /x
in each.
我确定有更简单的方法吗?
I'm sure there is an easier way to do this?
推荐答案
for %I in (.) do echo %~sI
有没有更简单的方法?
这篇关于获取DOS路径而不是Windows路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!