1

When I open Powershell, and type winget - this is the response:

winget : The term 'winget' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1

  • winget
  •   + CategoryInfo          : ObjectNotFound: (winget:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    
    
    

Suggestion [3,General]: The command winget was not found, but does exist in the current location. Windows PowerShell does not load commands from the current location by default. If you trust this command, instead type: ".\winget". See "get-help about_Command_Precedence" for more details.

But if I go to the folder where winget is located (in my case %AppData%\Local\Microsoft\WindowsApps\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\winget.exe and type in winget with a "./" infront of it - it works fine! So my question is, how do I point a command like winget to execute the file located as mentioned above, but from any directory I'm in?

For instance, in linux I can use

"alias winget='%AppData%\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\winget.exe"

and it'll point the command to the location specified. Is there any way I can do this, but in Powershell/CMD?

2 Answers 2

1

"if I go to the folder where winget is located ... a "./" infront of it "

instead, just put a "." in front of the whole path to winget.

i don't have winget, but this launches acrobat reader for me in powershell from any directory:

."C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe"

2
  • So you're saying I should open Powershell and type ".winget" or ".%AppData%\Local\Microsoft\WindowsApps\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\winget.exe"? Sep 13, 2022 at 16:00
  • the whole path to winget.
    – curtmcgirt
    Sep 13, 2022 at 16:36
0

I had the same problem on a fresh Windows 10 Pro 22H2 install. Used Microsoft Store to install the App Installer to get winget available in PowerShell, but got the same error message as op.

To get it working I had to use the Repair function in Settings --> Apps --> App Installer --> Advanced options --> Repair.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .