Relevant area(s)
PowerShell Module, WinGet CLI
Relevant command(s)
winget install
Brief description of your issue
When using winget to install software with the -l parameter to specify a custom installation path, the path is correctly honored on the first installation. However, after uninstalling and reinstalling the same or a different version of the software, winget ignores the custom path and defaults to the user's AppData directory (e.g., C:\Users\user\AppData\Roaming). This issue is reproducible with multiple packages, such as Tencent.WeChat and JetBrains.IntelliJIDEA.Ultimate, indicating a potential bug in winget's path-handling logic after an uninstall-reinstall cycle.
Steps to reproduce
- Run the initial installation command with a custom path, for example:
winget install Tencent.WeChat -l "D:\my-software\WinGet\WeChat". Verify that the software is installed correctly in the specified directory.
- Uninstall the software using winget or the system uninstaller.
- Run the installation command again for the same package or a related version (e.g.,
winget install Tencent.WeChat.Universal -l "D:\my-software\WinGet\WeChat").
- Observe that the software is installed to the default path (
C:\Users\user\AppData\Roaming) instead of the custom path.
- Optional: Restart the command-line interface and repeat step 3; the issue persists. Test with other packages like
JetBrains.IntelliJIDEA.Ultimate to confirm reproducibility.
Expected behavior
Winget should consistently respect the -l parameter and install the software to the specified custom path every time the installation command is executed, regardless of whether the software was previously installed or uninstalled.
Actual behavior
After uninstalling and reinstalling, winget fails to adhere to the custom path specified by -l, automatically falling back to the default user directory (e.g., C:\Users\user\AppData\Roaming). The first installation may work correctly, but subsequent reinstalls exhibit inconsistent behavior.
Environment
PS C:\Windows\system32> winget --info
Windows 程序包管理器 v1.11.510
版权所有 (C) Microsoft Corporation。保留所有权利。
Windows: Windows.Desktop v10.0.26200.6899
系统体系结构: X64
软件包: Microsoft.DesktopAppInstaller v1.26.510.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 已禁用
Relevant area(s)
PowerShell Module, WinGet CLI
Relevant command(s)
winget install
Brief description of your issue
When using winget to install software with the -l parameter to specify a custom installation path, the path is correctly honored on the first installation. However, after uninstalling and reinstalling the same or a different version of the software, winget ignores the custom path and defaults to the user's AppData directory (e.g., C:\Users\user\AppData\Roaming). This issue is reproducible with multiple packages, such as Tencent.WeChat and JetBrains.IntelliJIDEA.Ultimate, indicating a potential bug in winget's path-handling logic after an uninstall-reinstall cycle.
Steps to reproduce
winget install Tencent.WeChat -l "D:\my-software\WinGet\WeChat". Verify that the software is installed correctly in the specified directory.winget install Tencent.WeChat.Universal -l "D:\my-software\WinGet\WeChat").C:\Users\user\AppData\Roaming) instead of the custom path.JetBrains.IntelliJIDEA.Ultimateto confirm reproducibility.Expected behavior
Winget should consistently respect the
-lparameter and install the software to the specified custom path every time the installation command is executed, regardless of whether the software was previously installed or uninstalled.Actual behavior
After uninstalling and reinstalling, winget fails to adhere to the custom path specified by
-l, automatically falling back to the default user directory (e.g.,C:\Users\user\AppData\Roaming). The first installation may work correctly, but subsequent reinstalls exhibit inconsistent behavior.Environment