Why is my alias in CMDER behaving differently than when I enter a file path?

444 Views Asked by At

I'm using CMDER and want to make this filepath: D:\Documents\Programming an alias (pg), so that I can just type "cd /d pg" and cd there. When I type this:

cd /d D:\Documents\Programming

it works just fine, but when I create an alias like this:

alias pg=D:\Documents\Programming

then enter

cd /d pg

I get this result:

The system cannot find the path specified

Why is that? Just a note, I am using CMDER but figured aliasing is the same across Terminal and Windows CMD.

1

There are 1 best solutions below

0
On BEST ANSWER

alias pg="cd /d D:\Documents\Programming"

is of wrong syntax because of the single " which lets cmd.exe think it should run the file "cd /d D:\Documents\Programming". Define the alias pg with

alias pg=cd /d D:\Documents\Programming

reposted @Mofi's answer here because commments can't be marked as answers. Feel free to post your answer if you want your answer accepted and I'll delete this one!