winget-cli icon indicating copy to clipboard operation
winget-cli copied to clipboard

winget prompts on first time use

Open Tarjei-stavanger opened this issue 10 months ago • 7 comments

Brief description of your issue

I have used winget in the Windows Sandbox. I'm not sure if this is a documentation issue or a bug. Or both.

The winget command prompts for input on first use. That is not good since I see winget as something that our users will run in the background to install apps.

Image

winget search rayvn
The `msstore` source requires that you view the following agreements before using.
Terms of Transaction: https://aka.ms/microsoft-store-terms-of-transaction
The source requires the current machine's 2-letter geographic region to be sent to the backend service to function properly (ex. "US").

Do you agree to all the source agreements terms?
[Y] Yes  [N] No: y
No package found matching input criteria.

It is important to us that there is no prompting since our users are unlikely to see winget in action.

Tarjei-stavanger avatar Feb 25 '25 08:02 Tarjei-stavanger

WinGet ships with two default sources - winget (the Community repository) & msstore (Microsoft Store). WinGet here is asking you to accept Microsoft Store's terms & conditions

You can either pass the --accept-source-agreements argument the first time you use WinGet or if you don't want the store source at all you can also remove it via the winget source command

mdanish-kh avatar Feb 25 '25 09:02 mdanish-kh

Thanks! That helped.

I am a disappointed that it is not mentioned in the list of parameters.

--accept-source-agreements only worked at the end of the command line.

Tarjei-stavanger avatar Feb 25 '25 10:02 Tarjei-stavanger

If you're doing an automated solution, I'd suggest using the PowerShell module (or implementing against the COM APIs) as it's going to be a bit friendlier than trying to parse the strings coming out of WinGet.

denelon avatar Feb 25 '25 21:02 denelon

I'm only using PowerShell to install winget. We will be looking into using winget to pre-install software for the users.

Tarjei-stavanger avatar Feb 26 '25 05:02 Tarjei-stavanger

Will you be leveraging a WinGet Configuration file, or are you planning on scripting a series of Install-WinGetPackage cmdlet calls?

denelon avatar Feb 26 '25 16:02 denelon

My plan is to install both WinGet and PSWindowsUPdate at the same time. They both have the same PowerShell configuration requirements.

Tarjei-stavanger avatar Feb 27 '25 06:02 Tarjei-stavanger

PS C:\WINDOWS\system32> winget --accept-source-agreements
Windows Package Manager v1.11.400
Copyright (c) Microsoft Corporation. All rights reserved.

Argument name was not recognized for the current command: '--accept-source-agreements'

It looks like it neither accepts "Y", "yes", nor "Yes" as a response to the prompt. Nor does this command line switch appear to accept. Microsoft really have a knack of taking working things and making them diabolically broken.

pbhj avatar Jul 23 '25 21:07 pbhj

PS C:\WINDOWS\system32> winget --accept-source-agreements
Windows Package Manager v1.11.400
Copyright (c) Microsoft Corporation. All rights reserved.

Argument name was not recognized for the current command: '--accept-source-agreements'

It looks like it neither accepts "Y", "yes", nor "Yes" as a response to the prompt. Nor does this command line switch appear to accept. Microsoft really have a knack of taking working things and making them diabolically broken.

same here as of today, did you got it worked out as PS doesnt give any yes or no option:

Im using this command winget install .\setup_4.x --accept-package-agreements

IIIdefconIII avatar Nov 19 '25 12:11 IIIdefconIII