rendering

The detailed steps

1. InstallPowershell7

Here is the download address of the official website

2. InstallVS Code

Note: VS Code is installed to facilitate the opening of the configuration file. You can choose not to install VS Code here, but it is only recommended (for opening the PowerShell configuration file).

3. The installationscoop

Scoop is a package management tool for Windows (unofficially), similar to Yum for Linux or Homebrew for MAC. Open PowerShell 7 and type the following command:

Setexecutionpolicy remotesign-scope CurrentUser # Download script from network and install > invoke-expression (new-object System.Net.WebClient).DownloadString('https://get.scoop.sh') # Install with the following address) > invoke-expression (new-object System.Net.WebClient).DownloadString('https://cdn.yulinyige.com/script/scoop-installs.ps1')Copy the code

4. Installoh-my-posh 和 posh-git

Open the PowerShell 7 console and type the following command:

> Install-Module posh-git
> Install-Module oh-my-posh
Copy the code

Note that when prompted during installation, type Y to continue installation.

5. Configure the Powershell configuration file

  • Open the configuration file (Option 1: No VSCode installed)

Open the PowerShell 7 console and enter the command

> $PROFILE
Copy the code

In the command output, you can see the powerShell configuration file location:

Locate the file and open the configuration file

  • Open the configuration file (Option 2: VSCode installed)

Open the PowerShell 7 console and type the following command:

> code $PROFILE
Copy the code
  • Copy the following commands in the configuration file
echo 'Welcome, Accour'
Import-Module posh-git
Import-Module oh-my-posh
Set-PoshPrompt -Theme powerlevel10k_rainbow
Copy the code

Once saved, open the PowerShell console again to see the effect.(For additional topics, please referOther official website topics)

6. Fonts

If Chinese characters and ICONS are garbled, change the font, open the PowerShell 7 console, and type the following command:

> scoop search FantasqueSansMono-NF
> scoop bucket add 'nerd-fonts'
> scoop install FantasqueSansMono-NF
Copy the code

After installation, change the fonts in the default values in the Powershell console:

After selecting the installed fonts and confirming, restart the PowerShell console to resolve the garbled characters.

7. The VSCode console is garbled

If you use this powershell in the VSCode editor, you need to add the font to the font configuration in your Settings:

Save the configuration and restart the terminal to resolve garbled characters.