這裏是我的個人資料的一部分:我的配置文件中的某些Powershell別名未加載,爲什麼?
#alias gs='git status'
function GitStatus { & git status $args }
Set-Alias -Option AllScope -Name gs -Value GitStatus
# aliases - other ----------------------------------
function Touch { & echo $null >> $args }
Set-Alias -Option AllScope -Name touch -Value Touch
function LL { & ls }
Set-Alias -Option AllScope -Name ll -Value LL
function Open { & Invoke-Item $args }
Set-Alias -Option AllScope -Name open -Value Open
echo "Loading profile v6..."
我的資料是:
C:\用戶\ [用戶名] \文檔\ WindowsPowerShell \ Microsoft.PowerShell_profile.ps1
輪廓加載沒有任何錯誤:
$ .$PROFILE
Loading profile v6...
但是open
別名未加載。
$ open .\coverage\report.html
open : The term 'open' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if
a path was included, verify that the path is correct and try again.
但是gs
的別名是。
$ gs
On branch f/listener
Changes to be committed:
那麼我是怎麼在一個情況下我的一些別名負荷有的沒有?沒有錯誤時,加載配置文件....
$ $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
5 1 14393 1198
'(gal open).ReferencedCommand' – PetSerAl
那是什麼? .. – jcollum
如果這個命令沒有錯誤地完成,那麼加載'open'別名,並且這個命令顯示由別名引用的命令。順便說一句,你是否知道PowerShell不區分大小寫? – PetSerAl