Windows 11 工具链部署与 SSH 踩坑笔记

发布时间:2026/9/2 5:37:29
Windows 11 工具链部署与 SSH 踩坑笔记 设备MAXSUN MS-H110ZL / 8GB RAM / NVIDIA Quadro P1000系统Windows 11 IoT Enterprise LTSC 2024NTLite 精简镜像一、已部署工具链全部放在C:\Users\root\AppData\Local\Microsoft\WindowsApps\默认在 PATH工具文件说明neofetchwinfetch.ps1 neofetch.cmdPowerShell 版GitHub: lptstr/winfetchbusyboxbusybox.exe 180 个硬链接v1.38.00.7MBcurl系统自带真·curl 8.8.0wgetbusybox 的 wget 链接1.1 busybox 使用powershellbusybox --install # 生成 grep/sed/awk/tar/vi/sh 等 180 个硬链接不占额外磁盘 busybox --list # 查看全部 applet sh -c ... # 迷你 unix shell1.2 neofetch 安装powershell# 下载 winfetch.ps1 curl -sL https://raw.githubusercontent.com/lptstr/winfetch/master/winfetch.ps1 -o /tmp/winfetch.ps1 # 创建 neofetch.cmd 包装器 $neofetchCmd echo offrnpowershell -NoProfile -ExecutionPolicy Bypass -File C:\Users\root\AppData\Local\Microsoft\WindowsApps\winfetch.ps1 %* [System.IO.File]::WriteAllText(C:\Users\root\AppData\Local\Microsoft\WindowsApps\neofetch.cmd, $neofetchCmd, [System.Text.Encoding]::ASCII)关键winfetch.ps1必须使用 UTF-8 with BOM 编码才能在 PowerShell 5.1 中正常运行否则会出现乱码或执行失败。1.3 curl/wget 别名冲突PowerShell 内置了curl和wget别名指向Invoke-WebRequest会挡住同名 exe。已在 PowerShell profile 中移除别名现在curl 微软原生 curl 8.8.0wget busybox wget二、踩坑笔记SSH 远程操作 Windows以下记录在 Linux 端通过 SSH 远程操作 Win11 时遇到的主要问题。坑 1PowerShell 引号地狱ssh host powershell -Command ...要经过三层解析bash → ssh → PowerShell双引号嵌套极易翻车。可靠替代方案按优先级scp 推脚本文件再执行—— 最稳任何复杂度都适用单层单引号包 PS 命令内部只用简单语法-EncodedCommandbase64 UTF-16LE—— 可行但生成麻烦坑 2cmd echo 会展开变量远程默认 shell 是 PowerShell 时cmd /c echo if ($env:X) ...里的$env:X会被外层 PowerShell 先展开成实际值。结论凡是含$的内容一律走 scp 推文件不要用命令行拼接。坑 3注册表值名带空格/括号reg add ... /v SimSun NSimSun (TrueType)引号穿三层必挂。解法写.reg文件scp 过去后用reg import。坑 4执行策略重启后重置RemoteSigned策略在一次重启后可能失效profile 加载失败 → SSH 又乱码。修复命令powershellSet-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force坑 5per-user 服务禁不掉OneSyncSvc、WpnUserService这类带_数字后缀的服务Stop/Set-Service只对当前实例生效登录一次就复活。解决必须改 HKLM 模板Start4。坑 6GitHub 直链资产名猜不中Weasel release 资产实际叫weasel-0.17.4.0-installer.exe与直觉不符。正确做法先用 API 列出资产再下载powershelliwr api.github.com/repos/rime/weasel/releases/latest | ConvertFrom-Json | Select -Expand assets | Select name, browser_download_urlWin11 本机直连 GitHub 不通时从 Linux 中转下载再 scp。坑 7NTLite 精简系统的隐藏地雷Defender 可能被物理删除不是禁用装第三方安全软件前先确认字体被裁剪 → 老软件乱码第一嫌疑是缺simsun.ttcwinget缺失、商店服务缺失属正常不必浪费时间排查三、Windows 激活状态当前已从评估版转换为Windows 11 IoT Enterprise LTSC 2024 永久激活。转换步骤下载 SKU 文件解压后将IoTEnterpriseS文件夹复制到C:\Windows\System32\spp\tokens\skus\执行转换命令cmdcscript.exe %windir%\system32\slmgr.vbs /rilc cscript.exe %windir%\system32\slmgr.vbs /upk cscript.exe %windir%\system32\slmgr.vbs /ckms cscript.exe %windir%\system32\slmgr.vbs /cpky cscript.exe %windir%\system32\slmgr.vbs /ipk KBN8V-HFGQ4-MGXVD-347P6-PDQGT用 MAS 激活C:\Users\root\MAS_AIO.cmd /HWID去除水印cmdreg add HKCU\Control Panel\Desktop /v PaintDesktopVersion /t REG_DWORD /d 0 /f taskkill /f /im explorer.exe start explorer.exe四、内存盘备忘未部署Windows 原生无内存盘。如需使用推荐 ImDisk开源CLI 友好cmdimdisk -a -s 1G -m R: -p /fs:ntfs /q /y imdisk -D8GB 内存建议 ≤2GB。五、快速恢复命令powershell# 修复执行策略 Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force # 更新 SSH profile # 确认 profile 存在且编码正确 notepad $PROFILE