尝试为 .exe 创建别名 - Powershell 说它无法解析别名

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

一些背景:我正在通过 Udacity "How to Use Git and GitHub" class 学习 GitHub。他们告诉我我需要使用命令行,而不是 Windows' 本机命令提示符。我已经安装了 GitHub,它似乎安装了 Git Shell 其中 运行s Powershell。我想创建 运行 Notepad++ 的快捷方式,我使用了以下命令:

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

似乎一切正常。它带有一点 table 显示命令类型、名称和定义。当我键入别名时,程序应该会打开。但是当我输入:

ntpd

我收到以下错误:

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.

我是 Powershell 的新手,真的不知道我做错了什么。

您确定 C:\Program Files (x86)\Notepad++\notepad.exe 存在吗?尝试 Test-Path "C:\Program Files (x86)\Notepad++\notepad.exe" 并查看结果。另外,不要使用 New-Item,只需使用 New-Alias