本文介绍了A'cd ..'在Windows命令提示符中快速移动到祖先目录的替代的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows 7开发机器上使用Windows命令提示符进行主导航,而我的日常工作需要我经常从目录结构中的一个位置到另一个位置。我注意到我经常使用'cd ..'移动到目录结构中的祖先目录。有减少多个顺序cd ..命令的打字成本的任何解决方案吗?例如,如果我可以键入一个命令,将我的x祖先上移到目录结构,那么我不需要键入'cd ..'x次。

主要目标是更快,更有效地,所以解决一般目标的其他答案也赞赏。
谢谢。

I use a Windows command prompt for primary navigation on my Window 7 development machine, and my daily process requires me to get from one location to another in the directory structure quite frequently. I notice that I use 'cd ..' frequently to move to ancestor directories in the directory structure. Is there any solution to reducing the typing cost of multiple sequential 'cd ..' commands? For instance, if I could type a command that would move me up x ancestors up into the directory structure, then I wouldn't need to type 'cd ..' x times.
The primary goal is to get around quicker and more efficiently, so other answers that solve the general goal are also appreciated.Thanks.

推荐答案

@ECHO OFF
SETLOCAL
SET /a times=%1 2>NUL
IF NOT DEFINED times SET /a times=1
IF %times%==0 (CD "%~1") else (FOR /l %%i IN (1,1,%times%) DO CD ..)
GOTO :EOF


$ b b

如何将它保存在路径,并调用 cdx.bat

cdx n

与n数字应该上升n个级别。

否则,应转到指定为%1的目录

with n numeric should rise n levels.
Otherwise, should go to directory nominated as %1

是 - 我知道评估不完全或不防弹。这是对可能感兴趣的人的练习...

Yes - I'm aware that the evaluation isn't complete or bulletproof. That's an exercise for those who may be interested...

这篇关于A'cd ..'在Windows命令提示符中快速移动到祖先目录的替代的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 14:09
查看更多