microsoft / microsoft/winget-cli

WinGet adds the relative path directly to the PATH.

Open
#5,438 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Issue-Bug Portable
Dominant language
C++
Stars
26.4k
Forks
1.8k
Avg merge
1d 11h
Merged PRs (30d)
15

Description

Brief description of your issue

I was trying to install a zip+portable package when I encountered an undefined command line alias, and when I checked the user PATH, I found that WinGet added a relative path directly to the user PATH.

Steps to reproduce
git clone https://github.com/DuckDuckStudio/winget-pkgs.git
cd winget-pkgs
gh pr checkout https://github.com/microsoft/winget-pkgs/pull/254394
winget install --skip-dependencies --manifest manifests/d/denglihong2007/CRSim/2.2.0.0/ -l ../Test
Expected behavior

The package can be started using a command line alias.

Actual behavior
> winget install --skip-dependencies --manifest . -l ../Test
已找到 CRSim [denglihong2007.CRSim] 版本 2.2.0.0
此应用程序由其所有者授权给你。
Microsoft 对第三方程序包概不负责,也不向第三方程序包授予任何许可证。
已跳过依赖项。
正在下载 https://github.com/denglihong2007/CRSim/releases/download/v2.2.0.0/CRSim-release-2.2.0.0.zip
  ██████████████████████████████  33.3 MB / 33.3 MB
已成功验证安装程序哈希
正在提取存档...
已成功提取存档
正在启动程序包安装...
已修改路径环境变量;重启 shell 以使用新值。
添加了命令行别名: "CRSim"
已成功安装
> winget list CRSim
名称  ID                                               版本
--------------------------------------------------------------
CRSim ARP\User\X64\denglihong2007.CRSim__DefaultSource 2.2.0.0
> CRSim
CRSim: The term 'CRSim' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Image

Environment
Windows 程序包管理器 v1.10.390
版权所有 (C) Microsoft Corporation。保留所有权利。

Windows: Windows.Desktop v10.0.22631.5189
系统体系结构: X64
软件包: Microsoft.DesktopAppInstaller v1.25.390.0

Winget 目录
-------------------------------------------------------------------------------------------------------------------
日志                   %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir
用户设置               %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json
可移植链接目录(用户)   %LOCALAPPDATA%\Microsoft\WinGet\Links
可移植链接目录(计算机) C:\Program Files\WinGet\Links
可移植包根目录(用户)   %LOCALAPPDATA%\Microsoft\WinGet\Packages
可移植包根目录         C:\Program Files\WinGet\Packages
可移植包根目录 (x86)   C:\Program Files (x86)\WinGet\Packages
安装程序下载           %USERPROFILE%\Downloads
配置模块               %LOCALAPPDATA%\Microsoft\WinGet\Configuration\Modules

链接
----------------------------------------------------------------------------
隐私声明             https://aka.ms/winget-privacy
许可协议             https://aka.ms/winget-license
第三方声明           https://aka.ms/winget-3rdPartyNotice
主页                 https://aka.ms/winget
Windows 应用商店条款 https://www.microsoft.com/en-us/storedocs/terms-of-sale

管理员设置                                状态
------------------------------------------------
LocalManifestFiles                        已启用
BypassCertificatePinningForMicrosoftStore 已禁用
InstallerHashOverride                     已禁用
LocalArchiveMalwareScanOverride           已禁用
ProxyCommandLineOptions                   已禁用
DefaultProxy                              已禁用
Additional Information

If a full path is used the PATH length limit is exceeded.

Image

WinGet-2025-05-07-11-12-22.928.log

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the winget install command with the referenced CRSim manifest and -l ../Test, then inspect the attached WinGet log. Trace how portable package installation adds the relative path and command-line alias; done means the alias works without adding an unusable relative PATH entry.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.