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
23.15k stars 1.44k forks source link

Print out location of installed .exe by default when running `winget install X` #1882

Open t-cadet opened 2 years ago

t-cadet commented 2 years ago

Description of the new feature / enhancement

I could not use the stack command after installing Haskell Stack and it really took me a while to figure out where the .exe was.

Having the location of the installed app printed out will definitely help to troubleshoot installation issues. This only takes one line on the screen so this should be the default behavior.

Proposed technical implementation details

No response

denelon commented 2 years ago

@tristanCadet I'm not sure if we get that information from "all" installers. There is a "--location" option to specify where you would like something to be installed, but again not "all" installers support that as an option. Out of curiosity, where did Haskell Stack get installed?

t-cadet commented 2 years ago

I see, maybe this can be done for installers that give the path then. --location or --interactive are indeed good workaround.

It got installed in C:\Users\XXX\AppData\Roaming\local\bin\ (I’m not sure if this is standard but I don’t use windows that much for programming things and so I didn’t know where to look)

jedieaston commented 2 years ago

It wouldn't work for all installers, but MSIs designate a ARPINSTALLLOCATION property which is put in the InstallLocation key in the Registry: https://docs.microsoft.com/en-us/windows/win32/msi/arpinstalllocation. Many installers do a similar thing, for example, Inno Setup sets a "Inno Setup: App Path" key: image

Of course this wouldn't be guaranteed for all installers, but there's other things we could try, like looking to see if the $PATH has changed before and after running an installer. No silver bullet, I'm afraid, but there's places to check.

denelon commented 2 years ago

I'd be very cautious about looking for $PATH changes. Multiple things could be going on at the same time like Windows Updates and other things running that might impact the path.

sredna commented 2 years ago

Setting InstallLocation is required by WACK.