Add-VsDevPwsh7
0.2.0
Locate installed Visual Studio instances via vswhere, generate a startup script that loads complete VS build environment for PowerShell 7.
Supports registering to Windows Registry and adding dedicated profile to Windows Terminal.
通过 vswhere 检索本机已安装的 Visual Studio,生成加载完整编译环境的 PowerShell 7 启动脚本,支持写入注册表注册程序、向 Windows Terminal 添加专属配置项。
Installation Options
Owners
Copyright
(c) 2026 ScriptForge. All rights reserved.
Package Details
Author(s)
- ScriptForge
Tags
VisualStudio PowerShell7 Developer Terminal
Functions
Test-Is64BitOS Test-ParameterDependency Register-VsDevTerminalToRegistry
Dependencies
This script has no dependencies.
Release Notes
## 0.2.0
### Added / 新增
- **New parameter `-Pwsh7Path`** / 新增参数 `-Pwsh7Path`:Custom PowerShell 7 path for registry and Windows Terminal / 支持自定义 PowerShell 7 路径,用于注册表和 Windows Terminal 配置
- **x64 OS & process detection** / x64 系统与进程检测:Blocks 32-bit PowerShell execution / 拒绝 32 位 PowerShell 运行,确保 VS 开发环境完整性
- **Full registry implementation** / 注册表写入完整实现:Writes DisplayName, Icon, InstallLocation, Uninstall strings, Version / 包含显示名称、图标路径、安装位置、卸载命令、版本号等完整字段
- **`$Version` internal variable** / 新增 `$Version` 内部变量:Unified version identifier across the script / 统一脚本版本标识
### Changed / 变更
- **Parameter type: `[switch]` → `[bool]`** / 参数类型变更:`-RegisterToRegistry` & `-AddToWindowsTerminal` now accept explicit `$false` / 支持显式 `$false` 传值
- **Split registry naming** / 注册表名称参数拆分:Replaced `-RegistryName` with `-RegistryDisName` (display only) + hardcoded internal key name / 原 `-RegistryName` 拆分为可配置显示名与内部硬编码名,避免用户误改卸载键路径
- **Refactored OS detection** / OS 检测逻辑重构:Flattened flow; x86 systems now return `-1` alongside Linux/macOS / 扁平化判断,x86 系统与 Linux/macOS 同等处理
- **Generated script quality** / 生成脚本质量提升:Added `[CmdletBinding()]` header, fixed variable escaping / 补全 `[CmdletBinding()]` 头部,修复变量引用转义
### Removed / 移除
- **⚠️ Breaking: Exit code `3` removed** / ⚠️ 破坏性变更:退出码 `3` 已移除:Admin failure now warns and skips instead of elevating / 管理员权限不足时改为警告跳过,不再自动提权退出
- **`-RegistryName` parameter** / `-RegistryName` 参数已移除:Superseded by `-RegistryDisName` / 功能由 `-RegistryDisName` 替代
### Fixed / 修复
- Fixed `vswhere` path variable not expanding in generated script / 修复生成脚本中 `vswhere` 路径变量未正确展开
- Fixed registry function parameter mismatch (`-ScriptPath` → `-ScriptDir`) / 修复注册表函数参数不匹配导致的潜在调用错误
FileList
- Add-VsDevPwsh7.nuspec
- Add-VsDevPwsh7.ps1