记录乱七八糟的配置-window

以下 仅为个人记录&翻查

工具

  • 烧录 Rufus https://rufus.ie/en/
  • 命令行管理 conemu https://github.com/ConEmu/ConEmu

  • 激活

    • win开源激活工具 https://github.com/massgravel/Microsoft-Activation-Scripts

    • Open PowerShell

    • For Windows 8, 10, 11: run

      irm https://get.activated.win | iex

  • vpn

    win/macos: https://github.com/clash-verge-rev/clash-verge-rev android: https://github.com/MetaCubeX/ClashMetaForAndroid/releases ios: spectre vpn production: https://secure.shadowsocks.au/

软件包管理

  • winget Windows 11, modern versions of Windows 10, and Windows Server 2025已经内置winget

  • 安装列表
    winget install nodejs windsurf 'Mozilla Firefox' git-cola.git-cola psmux
    
  • win11右键【显示更多】开关设置,管理员运行命令:
    • 关闭”显示更多”菜单reg.exe add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve
    • 打开”显示更多”菜单reg.exe delete "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /va /f

wsl

设置默认登录用户

cat > /etc/wsl.conf <<'EOF'
[user]
default=root
EOF

缩主机ping不到wsl的解决

引用https://github.com/microsoft/WSL/issues/4171#issuecomment-929858850,需要在防火墙入站规则中,打开以“虚拟机监控“virtual machine monitor“开头的所有服务

同局域网,其它机ping不通不机

可能是Window默认阻塞ICMP

New-NetFirewallRule -DisplayName "Allow ICMPv4 Echo" -Protocol ICMPv4 -IcmpType 8 -Direction Inbound -Action Allow

重命名已安装的发行版

  1. Stop all instances of WSL
  2. Open Registry Editor and go to HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss
  3. Find the distro you want to rename, look for the DistributionName
  4. Change it as you want
  5. Start WSL again, you can also execute wsl.exe -l -v to check if it changes

启动sshd服务

if ! pgrep -x "sshd" > /dev/null; then
    sudo service ssh start
fi

window ssh服务

@rem 安装服务
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
@rem 启动服务
Start-Service sshd
@rem 重启服务
Restart-Service sshd
@rem 设置随机启动
Set-Service -Name sshd -StartupType Automatic
@rem 返回服务状态
Get-Service sshd
  • 密钥登录
    • 若以admin组账号登录,在目标机器__PROGRAMDATA__/ssh/administrators_authorized_keys添加登录公钥
    • 若以普通账号登录,在在目标机器%USERPROFILE%/.ssh/authorized_keys添加登录公钥
    • 目标机器C:\ProgramData\ssh\ssh_config配置如下, ``` Match Group administrators AuthorizedKeysFile PROGRAMDATA/ssh/administrators_authorized_keys

StrictModes no PubkeyAuthentication yes


# windsurf 
    - 解决cluade等模型限制中国用户访问的问题
        - 启动时设置代理并启动
        ```bat
        cmd /c "set http_proxy=http://127.0.0.1:7897 && set https_proxy=http://127.0.0.1:7897 && windsurf的安装路径\Windsurf.exe"
        ```
    - 截至2025-12-14,windsurf官方还未支持账号配置和插件云保存,除了用提供数据同步的插件。若需要自行保存数据,需要手动导入导出的数据,windsurf和vscode同宗同源,vscode同步适用
        - 配置
            - 导出 重要的配置文件有2:快捷键配置keybindings.json和全局配置settings.json,无所谓的导出操作,直接复制一份即可。如果不知道配置路径,在配置界面切换到文本编辑模式,在文件标题栏右键就可跳转到文件位置

            - 导入 关闭windsurf进程,确保当前的配置和刚才复制出数据没有冲突。如果有,先手动合并数据,再将合并后的配置文件覆盖进来。重新打开windsurf
        - 插件
            - 导出
                linux/window `windsurf --list-extensions --show-versions > extensions_with_versions.txt`
            - 导入
                - linux `cat extensions_with_versions.txt | xargs -L 1 windsurf --install-extension`
                - window `Get-Content extensions_with_versions.txt | ForEach-Object { windsurf --install-extension $_ }`

# wsl

打出window subsystem子系统目录

`\\wsl$`


子系统里访问window文件系统,将以下配置添加到/etc/wsl.conf,如果没有则创建

[automount] options = “metadata”


为了方便切换工作环境,以指定window目录打开wsl
`wsl --cd F:\workspace`

如果有多个wsl发行版,返回当前发行版的ip
`hostname -I | cut -f 1 -d ' '`

# 网络
设置代理

set http_proxy=http://127.0.0.1:1080 set https_proxy=http://127.0.0.1:1080 ```

端口转发 netsh interface portproxy add v4tov4 listenport=27017 connectaddress=172.31.127.208 connectport=27017

例如:monogo安装在wsl,先用hostname -I | cut -f 1 -d ' ',查出本Wsl地址 然后在端口转发到netsh interface portproxy add v4tov4 listenport=27017 connectaddress=172.31.127.208 connectport=27017

删除端口映射 netsh interface portproxy delete v4tov4 listenport=27017

显示所有有映射 netsh interface portproxy show all

psmux

安装psmux插件前,给当前用户添加powershell执行权限 Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

visual studio

假设visual studio安装在D:\Program Files\Microsoft Visual Studio\2022\Enterprise

  • 设置编译环境
    • 32位环境 D:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars32.bat
    • 64位环境 D:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
  • msbuild路径 D:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin
  • cl路径 以sdk版本和x86|x64在不同目录下 D:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.43.34808\bin\Hostx86\x64

原文:
https://lizijie.github.io/2025/12/15/%E8%AE%B0%E5%BD%95%E4%B9%B1%E4%B8%83%E5%85%AB%E7%B3%9F%E7%9A%84%E9%85%8D%E7%BD%AE-window.html

常用命令

  • 以修改时间小到大排序 bat dir /T:W /O:D bat

作者github:
https://github.com/lizijie </b>

PREVIOUS记录乱七八糟的配置
NEXT记录乱七八糟的配置-rocky