Skip to content

Latest commit

 

History

History
31 lines (30 loc) · 1.29 KB

powershell.md

File metadata and controls

31 lines (30 loc) · 1.29 KB

更新PowerShell

  • 安装新版本:iex "& { $(irm https://aka.ms/install-powershell.ps1 -UseBasicParsing) }"
  • 设为默认版本
    • 点击设置
      img
    • 点击添加新配置文件
    • 将新版本的powershell路径添加进去
    • 然后在启动选项里将该新配置设置默认配置文件

添加命令别名

注意不是PowerShell里的Alias别名

  • 创建Powershell配置文件,若已创建则跳过
New-Item $profile -force -itemtype file
  • notepad $profile 编辑配置文件
  • 按如下格式添加命令
function 别名 { 需要替代的命令 }

eg.

remove-item alias:history # 可选,删除默认的别名,否则会先调用默认的
function history { cat C:\Users\xxx\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt }
  • 然后执行Set-ExecutionPolicy RemoteSigned 生效更改
  • 重启PowerShell即可

参考