Creating an alias for NPM using cmder in Windows
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

I'm using cmder on windows: http://bliker.github.io/cmder/

I've installed node.js from nodejs.org.

I can run npm in cmder by running this command:

C:\Program Files\nodejs\npm.cmd

Now how can I create an alias for this so I can just run, for example npm install -g bower?

I tried this:

alias npm="C:\Program Files\nodejs\npm.cmd"

But it reports back:

alias npm="C:\Program Files\nodejs\npm.cmd"
Files\nodejs\npm.cmd""] was unexpected at this time.

awarded to poserg

Crowdsource coding tasks.

1 Solution

Winning solution

If a filename includes spaces, it is necessary to use the 8.3 version of the name.

alias npm=C:\Progra~1\nodejs\npm.cmd $*

You can get the short name by using command:
dir /x c:\