Trying to make an alias for an .exe - Powershell saying it cannot resolve the alias

506 views Asked by At

Some backgroudn: I'm learning GitHub through the Udacity "How to Use Git and GitHub" class. They tell me I need to use Command Line, not Windows' native command prompt. I've installed GitHub, which appears to install Git Shell which runs Powershell. I want to create a shortcut to run Notepad++, and I used the following command:

new-item alias:ntpd -value 'C:\Program Files (x86)\Notepad++\notepad.exe'

Everything seems to work fine. It comes up with a little table showing the CommandType, Name, and Definition. The program should open when I type the alias. But when I type:

ntpd

I get the following error:

Cannot resolve alias 'ntpd' because it refers to term 'C:\Program Files (x86)\Notepad++\notepad.exe', which is not recognized as a cmdlet, function, operable program, or script file. Verify the term and try again.

I'm very new to Powershell and really can't figure out what I'm doing wrong.

1

There are 1 answers

7
SomeShinyObject On BEST ANSWER

Are you sure C:\Program Files (x86)\Notepad++\notepad.exe exists. Try a Test-Path "C:\Program Files (x86)\Notepad++\notepad.exe" and see the outcome. Also, instead of New-Item, just use New-Alias