microsoft / winget-cli

WinGet is the Windows Package Manager. This project includes a CLI (Command Line Interface), PowerShell modules, and a COM (Component Object Model) API (Application Programming Interface).
https://learn.microsoft.com/windows/package-manager/
MIT License
22.69k stars 1.41k forks source link

location param when I install it work not as expected #1639

Closed hjm7 closed 2 years ago

hjm7 commented 2 years ago

Brief description of your issue

I type winget install Fndroid.ClashForWindows -l "D:\Program Files\Clash for Windows".But clash is installed at "D:\Program".It did't work as expected.Besides it did't have any prompt about the incorrect location. Therefore I suppose to list install location with winget list/upgrade the same as #1626.

Steps to reproduce

Type winget install Fndroid.ClashForWindows -l "D:\Program Files\Clash for Windows" image

Expected behavior

It is installed at "D:\Program Files\Clash for Windows" .

Actual behavior

It is installed at "D:\Program" . image [winget log] 2021-10-25 16:56:18.604 [CORE] Settings loaded from settings.json 2021-10-25 16:56:18.605 [CORE] WinGet, version [1.1.12702], activity [{71609C32-906B-4EC0-916F-B6C3CD16942B}] 2021-10-25 16:56:18.605 [CORE] OS: Windows.Desktop v10.0.22000.282 2021-10-25 16:56:18.605 [CORE] Command line Args: "C:\Users\80500\AppData\Local\Microsoft\WindowsApps\winget.exe" install Fndroid.ClashForWindows -l "D:\Program Files\Clash for Windows" 2021-10-25 16:56:18.605 [CORE] Package: Microsoft.DesktopAppInstaller v1.16.12702.0 2021-10-25 16:56:18.605 [CORE] IsCOMCall:0; Caller: winget-cli 2021-10-25 16:56:18.609 [CLI ] WinGet invoked with arguments: 'install' 'Fndroid.ClashForWindows' '-l' 'D:\Program Files\Clash for Windows' 2021-10-25 16:56:18.609 [CLI ] Found subcommand: install 2021-10-25 16:56:18.609 [CLI ] Leaf command to execute: root:install 2021-10-25 16:56:18.612 [CLI ] Executing command: install 2021-10-25 16:56:18.612 [REPO] GetCurrentSourceRefs: Source named 'microsoft.builtin.desktop.frameworks' from origin Default is a tombstone and is dropped. 2021-10-25 16:56:18.612 [REPO] Default source requested, multiple sources available, creating aggregated source. 2021-10-25 16:56:18.612 [REPO] Adding to aggregated source: msstore 2021-10-25 16:56:18.612 [REPO] Source past auto update time [5 mins]; it has been at least 12 mins 2021-10-25 16:56:18.612 [REPO] Sending http GET request to: https://storeedgefd.dsx.mp.microsoft.com/v9.0/information 2021-10-25 16:56:20.861 [REPO] Response status: 200 2021-10-25 16:56:20.861 [REPO] Adding to aggregated source: winget 2021-10-25 16:56:20.861 [REPO] Source past auto update time [5 mins]; it has been at least 12 mins 2021-10-25 16:56:23.829 [CORE] Examining extension: PFN = Microsoft.Winget.Source_8wekyb3d8bbwe, ID = IndexDB 2021-10-25 16:56:23.829 [CORE] Found matching extension. 2021-10-25 16:56:23.832 [REPO] Remote source data was not newer than existing, no update needed 2021-10-25 16:56:23.843 [CORE] Examining extension: PFN = Microsoft.Winget.Source_8wekyb3d8bbwe, ID = IndexDB 2021-10-25 16:56:23.843 [CORE] Found matching extension. 2021-10-25 16:56:23.862 [REPO] Opening SQLite Index for ImmutableRead at 'C:\Program Files\WindowsApps\Microsoft.Winget.Source_2021.1025.929.93_neutral8wekyb3d8bbwe\Public\index.db' 2021-10-25 16:56:23.863 [SQL ] Opening SQLite connection: 'file:/C:/Program Files/WindowsApps/Microsoft.Winget.Source_2021.1025.929.93_neutral8wekyb3d8bbwe/Public/index.db?immutable=1' [1, 40] 2021-10-25 16:56:23.863 [REPO] Opened SQLite Index with version [1.3], last write [2021-10-25 16:29:36.000] 2021-10-25 16:56:23.945 [REPO] Sending http POST request to: https://storeedgefd.dsx.mp.microsoft.com/v9.0/manifestSearch 2021-10-25 16:56:24.501 [REPO] Response status: 200 2021-10-25 16:56:24.508 [CLI ] Found one app. App id: Fndroid.ClashForWindows App name: Clash for Windows 2021-10-25 16:56:24.509 [REPO] Downloading manifest 2021-10-25 16:56:24.509 [CORE] WinINet downloading from url: https://winget.azureedge.net/cache/manifests/f/Fndroid/ClashForWindows/0.18.5/7279-Fndroid.ClashForWindows.yaml 2021-10-25 16:56:26.398 [CORE] Download hash: 57792c85c288b0d2e48d4995fb5b18ae871da239fda11ff90a964e389d0222d0 2021-10-25 16:56:26.398 [CORE] Download completed. 2021-10-25 16:56:26.402 [CLI ] Manifest fields: Name [Clash for Windows], Version [0.18.5] 2021-10-25 16:56:26.404 [CLI ] Starting installer selection. 2021-10-25 16:56:26.405 [CLI ] Completed installer selection. 2021-10-25 16:56:26.416 [CLI ] Generated temp download path: C:\Users\80500\AppData\Local\Temp\WinGet\Fndroid.ClashForWindows.0.18.5 2021-10-25 16:56:26.416 [CORE] Downloading to path: C:\Users\80500\AppData\Local\Temp\WinGet\Fndroid.ClashForWindows.0.18.5 2021-10-25 16:56:26.417 [CORE] DeliveryOptimization downloading from url: https://github.com/Fndroid/clash_for_windows_pkg/releases/download/0.18.5/Clash.for.Windows.Setup.0.18.5.exe 2021-10-25 16:58:13.197 [CORE] Download completed. 2021-10-25 16:58:17.556 [CORE] Started applying motw to C:\Users\80500\AppData\Local\Temp\WinGet\Fndroid.ClashForWindows.0.18.5 with zone: 3 2021-10-25 16:58:17.558 [CORE] Finished applying motw 2021-10-25 16:58:17.558 [CLI ] Installer hash verified 2021-10-25 16:58:17.558 [CORE] Started applying motw to C:\Users\80500\AppData\Local\Temp\WinGet\Fndroid.ClashForWindows.0.18.5 with zone: 2 2021-10-25 16:58:17.565 [CORE] Finished applying motw 2021-10-25 16:58:17.566 [REPO] Creating PredefinedInstalledSource with filter [ARP] 2021-10-25 16:58:17.566 [REPO] Creating new SQLite Index [4294967295.4294967295] at ':memory:' 2021-10-25 16:58:17.566 [SQL ] Opening SQLite connection: ':memory:' [6, 0] 2021-10-25 16:58:17.598 [REPO] Examining ARP entries for Machine | X64 2021-10-25 16:58:17.611 [REPO] Examining ARP entries for Machine | X86 2021-10-25 16:58:17.624 [REPO] Examining ARP entries for User | X64 2021-10-25 16:58:17.683 [CLI ] Installer args: /S /ALLUSERS /D=D:\Program Files\Clash for Windows 2021-10-25 16:58:17.684 [CLI ] Successfully renamed downloaded installer. Path: C:\Users\80500\AppData\Local\Temp\WinGet\Fndroid.ClashForWindows.0.18.5.exe 2021-10-25 16:58:17.684 [CLI ] Starting: 'C:\Users\80500\AppData\Local\Temp\WinGet\Fndroid.ClashForWindows.0.18.5.exe' with arguments '/S /ALLUSERS /D=D:\Program Files\Clash for Windows' 2021-10-25 16:58:28.571 [REPO] Creating PredefinedInstalledSource with filter [ARP] 2021-10-25 16:58:28.571 [REPO] Creating new SQLite Index [4294967295.4294967295] at ':memory:' 2021-10-25 16:58:28.571 [SQL ] Opening SQLite connection: ':memory:' [6, 0] 2021-10-25 16:58:28.644 [REPO] Examining ARP entries for Machine | X64 2021-10-25 16:58:28.686 [REPO] Examining ARP entries for Machine | X86 2021-10-25 16:58:28.715 [REPO] Examining ARP entries for User | X64 2021-10-25 16:58:29.006 [CLI ] During package install, 1 changes to ARP were observed, 1 matches were found for the package, and 1 packages were in both 2021-10-25 16:58:29.006 [CLI ] The entry determined to be associated with the package is 'Clash for Windows 0.18.5', with publisher 'Fndroid' 2021-10-25 16:58:29.007 [CLI ] Removing installer: C:\Users\80500\AppData\Local\Temp\WinGet\Fndroid.ClashForWindows.0.18.5.exe 2021-10-25 16:58:29.020 [CLI ] Leaf command succeeded: root:install

Environment

Windows Package Manager v1.1.12702
Windows: Windows.Desktop v10.0.22000.282
Package: Microsoft.DesktopAppInstaller v1.16.12702.0
hjm7 commented 2 years ago

when I try a intstall command with another location like as "D:\pp s".It was installed at "D:\pp".This package can't recognize the path include 'space'.When I use "clash for windows" installer with gui,it support the path with space.But when I try other winget install other package don't have this problem.

ItzLevvie commented 2 years ago

You'll need to escape the quotes.

The below worked fine for me in Command Prompt.

winget install Fndroid.ClashForWindows --location """D:\Program Files\Clash for Windows"""

In Windows PowerShell, it's slightly different. You can refer to https://github.com/microsoft/winget-cli/discussions/1296.

hjm7 commented 2 years ago

@ItzLevvie,Your solution work fine in Command Prompt.But when I use powershell 7.1.5 it doesn't work,I try as #1296.Its solution is in #1317.but it doesn't work.It pop the installer windows make me select path.Besides like winget install Notepad++ -l "D:\Program Files\Notepad" -s winget in powershell work fine.

ItzLevvie commented 2 years ago

Some installers work differently, some requires escaping the quotes and some don't.

This should work in PowerShell:

winget install Fndroid.ClashForWindows --location `""""D:\Program Files\Clash for Windows`""""
hjm7 commented 2 years ago

Some installers work differently, some requires escaping the quotes and some don't.

This should work in PowerShell:

winget install Fndroid.ClashForWindows --location `""""D:\Program Files\Clash for Windows`""""

Thanks a lot.