跳转到内容

开始使用

Winenv 支持 Windows 11。首次安装只需要普通 PowerShell、网络连接,以及 Windows 11 通常随 App Installer 提供的 WinGet。

打开普通 PowerShell,执行:

终端窗口
irm https://raw.githubusercontent.com/YangYuS8/winenv/main/install.ps1 | iex

安装器会自动完成以下工作:

  1. 从 GitHub Releases 获取最新稳定版;
  2. 下载版本 ZIP 和 SHA256SUMS 并校验 SHA-256;
  3. 安装到 %LOCALAPPDATA%\Winenv\versions;
  4. 创建全局短命令 win;
  5. 探测 PowerShell 7、fzf 和 mise 的真实路径及版本,兼容时直接复用;
  6. 只为缺失的运行能力安装内置 Profile 声明的默认包。

安装结束后新开一个 PowerShell 窗口:

终端窗口
win check
win

英文是项目的权威语言。第一次运行时,Winenv 会读取当前 Windows UI culture:zh-* 自动使用简体中文,其余语言使用英文。

终端窗口
win lang # 查看当前语言及其来源
win lang en # 持久使用英文
win lang zh # 持久使用简体中文
win lang auto # 恢复系统自动检测

单次执行可以使用 -Lang en、-Lang zh 或 -Lang auto。WINENV_LANG 环境变量可为当前终端或自动化设置默认值;明确传入的 -Lang 优先级最高。

安装时也可以直接选择语言:

终端窗口
& ([scriptblock]::Create((irm https://raw.githubusercontent.com/YangYuS8/winenv/main/install.ps1))) -Lang zh

WinGet 是 Windows 侧的基础安装通道。找不到 winget.exe 时,安装器会先尝试重新注册 Windows 11 自带的 App Installer;仍不可用则停止,并给出 Microsoft Store 和官方修复方向。

Winenv 不会静默提权,也不会为了补 WinGet 擅自安装 PowerShell Gallery 模块。

可以从本地文件或 HTTPS 链接导入:

终端窗口
& ([scriptblock]::Create((irm https://raw.githubusercontent.com/YangYuS8/winenv/main/install.ps1))) -UserProfile C:\Users\me\my-winenv.json
& ([scriptblock]::Create((irm https://raw.githubusercontent.com/YangYuS8/winenv/main/install.ps1))) -UserProfile https://example.com/my-winenv.json

Profile 会作为独立的一层加入,不会覆盖内置运行层或其他用户 Profile。详见组合 Profile。

想先获得 win 命令、不立即安装 Profile 中的软件:

终端窗口
& ([scriptblock]::Create((irm https://raw.githubusercontent.com/YangYuS8/winenv/main/install.ps1))) -ToolOnly

之后可随时执行 win add 应用当前 Profile。

终端窗口
& ([scriptblock]::Create((irm https://raw.githubusercontent.com/YangYuS8/winenv/main/install.ps1))) -Version 0.13.0

不指定 -Version 时始终安装最新稳定 Release;日常执行 win up 会先更新 Winenv 自身。