电源外壳 预览 7 Install and Upgrade.
笔记: At this moment 电源外壳 7 available as Preview 5.
在这个 邮政, we make two things:
Install Windows PowerShell 7 预览
电源外壳 7 is available cross-platform. It can be installed on 视窗, macos, Linux, and others.
Installing via GitHub
You’ll first need to 下载 电源外壳 7 从 PowerShell GitHub repo releases page (预览 5 at this moment).
To install it manually from the GitHub repo, you can find the version you’d like to install and find the Assets section. Then, find the operating system you’d like to install it on.
下载 this file and walk through the installation.
Installing via Script
To install 电源外壳 7 从 视窗 电源外壳, you can use a 电源外壳 脚本 (install-powershell.ps1) provided by Microsoft. You can 下载 and run this script in one shot using this simple one-liner. As you can see below, this method creates a folder in your TEMP directory and 下载 the latest version of 电源外壳.
This is, by far, the easiest way to get 电源外壳 7 up and running quickly.
Invoke-Expression "& { $(Invoke-RestMethod -Uri https://aka.ms/install-powershell.ps1) } -UseMSI -Preview -Quiet"
This one will execute a script from the GitHub page to automatically 下载 and install the latest preview version.
There are a few different parameters that can be used to install different versions:
“预览” – This is required to install PS 7 预览. If not included you will get the latest release of PS 6.
“Daily” will give you the latest daily build. This is a very bleeding edge and may include more bugs.
“Destination” allows you to pick a different install folder. The default path in 视窗 is “C:\Program Files\PowerShell\7”
“DoNotOverwrite” can be used to not overwrite the destination folder if it already exists. If you want to update from a previous release/preview of 电源外壳 7 you should not use this.
“Quiet” will install without using the wizard.
“AddToPath” does different things based on the OS:
- On 视窗, add the absolute destination path to the ‘User’ scope environment variable ‘Path’;
- On Linux, make the symlink ‘/usr/bin/pwsh’ points to “$Destination/pwsh”;
- On MacOS, make the symlink ‘/usr/local/bin/pwsh’ points to “$Destination/pwsh”.
Upgrade to Windows PowerShell 7 from PowerShell Core
什么时候 电源外壳 7 comes out of Preview, the GA version will create a folder called 7. This will then be where all minor version upgrades to 电源外壳 7 will be applied overwriting the last version.
When the 电源外壳 7 installer completes, you’ll find two folders in C:\Program Files\PowerShell called 6 和 7-预览 (for the preview version). Each folder stores a completely different version.
Get-ChildItem -Path 'C:\Program Files\PowerShell\'
Directory: C:\Program Files\PowerShell
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 11/20/2019 11:36 AM 7-preview