如何获取%CD%的父路径 [英] How to get parent path of %CD%

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

问题描述

如何获取当前%CD%的父路径.

How do I get the parent path of the current %CD%.

例如:

ECHO %CD%

结果:C:\Windows\System32

(这不起作用)

ECHO %CD%..\

所需结果: C:\Windows

推荐答案

尝试更改当前目录,然后使用%cd%:

Try changing the current directory and then using %cd%:

pushd ..
echo %cd%
popd

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

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