Is there anyway to create an alias to cd PATH
command in cmd?
For example, instead of typing cd C:\John\Pictures
I'd like to type just pictures
in cmd and press Enter and it should simply take me to C:\John\Pictures
.
Is that possible and how?
You will need to use the doskey
command which creates aliases, e.g.:
doskey shortcut=cd /d PATH
or specifically:
doskey pictures=cd /d C:\John\Pictures
Note that you mustn't quote the command like set
: the quotes will included both in the macro and the command!
Another way to do that (more complicated) is to create a file named like your shortcut (e.g. pictures.bat
) and insider put @cd /d C:\Jogn\Pictures
and locate it in C:\Windows\System32
(or else in %windir%\System32
; the same thing).
The other way as you mentioned in your comment, is to open cmd with a custom command, e.g. as you mentioned cmd.exe /K doskey pictures=cd /d C:\John\Pictures
.
Note that /d
option is important if you are in a different drive, so put it always with cd
as it is good practice!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With