Skip to content

Instantly share code, notes, and snippets.

@thomjiji
Last active April 29, 2026 06:48
Show Gist options
  • Select an option

  • Save thomjiji/e9cd09c2827d77635e84df16724c20d6 to your computer and use it in GitHub Desktop.

Select an option

Save thomjiji/e9cd09c2827d77635e84df16724c20d6 to your computer and use it in GitHub Desktop.
windows-setup.org

Windows Setup Guide

Setup OpenSSH

  1. 搜索“可选功能” > “OpenSSH”,确保 OpenSSH Server 和 Client 已安装。
  2. 搜索并打开“服务”
  3. 往下拉找到 OpenSSH Server,双击点开,弹出一个窗口。
  4. 启动类型选择“自动”,然后服务状态下面点击启动。

Windows Learn | Get started with OpenSSH for Windows

Install WinGet

如果 Windows 没有自带 winget,那么去微软应用商店搜索“应用安装程序”(App Installer)。

Install PowerShell

winget install --id Microsoft.PowerShell --source winget

让 SSH 默认开启的是 PowerShell 而不是 cmd.exe

Windows Learn | OpenSSH Server configuration for Windows Server and Windows

以管理员权限运行一个 PowerShell session,然后运行以下命令:

New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" `
  -Name "DefaultShell" `
  -Value "$(Get-Command pwsh).Path" `
  -PropertyType String -Force
(get-command pwsh).path
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
C:\Program Files\PowerShell\7\pwsh.exe

// The path of Microsoft Store installed pwsh
C:\Program Files\WindowsApps\Microsoft.PowerShell_7.5.4.0_x64__8wekyb3d8bbwe\pwsh.exe

如何知道当前确实开启了 pwsh

$PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.6.1
PSEdition                      Core                        <=== indicates pwsh
GitCommitId                    7.6.1
OS                             Microsoft Windows 10.0.26200
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.4
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

如果以上 PSEdition 显示为 Core 那么就是 ~pwsh~;如果显示为 =Desktop=,那么就是 Windows PowerShell(powershell.exe)。

Navigation inside PowerShell

By default, PowerShell uses Windows-style keybindings (similar to Notepad). To get Emacs/Bash-style navigation (Ctrl-a, Ctrl-e, Alt-f, etc.), enable Emacs mode via PSReadLine:

Set-PSReadLineOption -EditMode Emacs

To make this permanent, add it to your PowerShell profile. The command below creates the profile file if it doesn’t exist, then appends the setting:

if (!(Test-Path (Split-Path $PROFILE))) {
    New-Item -ItemType Directory -Path (Split-Path $PROFILE) -Force
};
if (!(Test-Path $PROFILE)) {
    New-Item -ItemType File -Path $PROFILE -Force
};
Add-Content -Path $PROFILE -Value 'Set-PSReadLineOption -EditMode Emacs';
. $PROFILE

To learn more about PSReadLine options:

Get-Help -Name Set-PSReadLineOption

Install Scoop on Windows

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression

https://scoop.sh/

Install Rsync on Windows

scoop install cwrsync btop

Install Apps using winget

Export apps list from a working Windows machine:

winget export -o apps.json
winget export -o apps.json --source winget

Install apps from the app list file:

winget import -i apps.json

Manually install apps one by one:

winget install --id Notion.Notion --source winget
winget install --id ByteDance.Feishu --source winget
winget install Feishu

Recommended way to install applications on Windows from Terminal:

Install Git

winget install --id Git.Git -e --source winget

Windows Debloat

https://github.com/Raphire/Win11Debloat

  1. Open PowerShell or Terminal, preferably as an administrator.
  2. Copy and paste the command below into PowerShell:
& ([scriptblock]::Create((irm "https://debloat.raphi.re/")))
  1. Wait for the script to automatically download Win11Debloat.
  2. Carefully read through and follow the on-screen instructions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment