Question

Say I want to navigate to a directory but don't want typing the directory every time.

Is there a way to define a customized short keys in the cmd prompt like

set root=C:\Users\sz\to\this\path

So next time only typing cd root can direct me to the target root. I hope the short key will be stored permanently - when I re-open the cmd prompt, the short key is still valid.

Even better, is it possible to define a short key that only typing root (without typing cd) can do the same thing?

Thanks in advance!

Was it helpful?

Solution

doskey root=cd /d "C:\Users\sz\to\this\path"

Note: the macro is gone, if you close your cmd-window

EDIT

another way is a batchfile somewhere in the path, for example root.bat as a "one-liner":

@cd /d "C:\Users\sz\to\this\path"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top