打开 Windows PowerShell 输入
echo $PROFILE
output:
C:\Users\你的用户名\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
如果文件不存在,输入
new-item -type file -path $profile -force
会帮你创建一个文件,然后继续走下面的步骤:
如果文件存在,输入
notepad $PROFILE
会打开记事本进行编辑
把<alias-name>替换成你想改的别名添加进去
Set-Alias -Name <alias-name> -Value pnpm
保存,重启 Windows PowerShell
参考
Powershell: $profile is pointing to a path that I can't find and setting permanent path