官方文档

学习网站

ITProToday

主题

特别的主题

What is “date”? “Get-Command date” throws CommandNotFoundException - Stack Overflow
What’s the better (cleaner) way to ignore output in PowerShell? - Stack Overflow
Whats the cmd/powershell equivalent of which on bash? - Stack Overflow

定制

about_Profiles | Microsoft Docs
about_Prompts | Microsoft Docs

更新Core

  1. $randomFileName = [System.IO.Path]::GetRandomFileName()
  2. $tmpMsiPath = Join-Path ([System.IO.Path]::GetTempPath()) "$randomFileName.msi"
  3. Invoke-RestMethod -Uri https://github.com/PowerShell/PowerShell/releases/download/v6.2.3/PowerShell-6.2.3-win-x64.msi -OutFile $tmpMsiPath
  4. try {
  5. Microsoft.PowerShell.Management\Start-Process -Wait -Path $tmpMsiPath
  6. }
  7. finally {
  8. Microsoft.PowerShell.Management\Remove-Item $tmpMsiPath
  9. }

开启代理下载更快
这段代码其实是下载安装文件并执行,还是会有图形安装界面。

Path

Path Class (System.IO) | Microsoft Docs

  1. [System.IO.Path]::GetRandomFileName()
  2. [System.IO.Path]::GetTempPath()

Filter

Filtering PowerShell Objects - ITProToday

迭代

PowerShell ForEach-Object Parallel Feature | PowerShell

Format

Using Format Commands to Change Output View | Microsoft Docs
Formatting objects in PowerShell with Format-Custom, Format-List, Format-Table, and Format-Wide – 4sysops

调试

Debugging PowerShell script in Visual Studio Code – Part 1 | Scripting Blog
Debugging PowerShell script in Visual Studio Code – Part 2 | Scripting Blog

Tab Completion

Adding tab-completion to your PowerShell Functions – FoxDeploy.com