How to prevent Winget Batch Commands from stopping if one of the applications is already installed?

trello 20 Reputation points
2023-08-02T23:54:30.9066667+00:00

I am trying to install several apps with winget in a single command on Windows 10.

Example:

winget install --id=Google.Chrome -e && winget install --id=Obsidian.Obsidian -e

Problem:

if google chrome would be installed already then it stops with a message that the application is already installed and the following commands (installation of obsidian) are not executed anymore.

Are there any parameters that make sure that in case of error the full command is executed?

Also another issue I have is that one application installation fails because of some problem with incorrect hash.... why is that?

Windows for business | Windows Client for IT Pros | User experience | Other
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous
    2023-08-03T03:22:41.6066667+00:00

    Hi,

    Please use "&" instead of "&&".

    winget install --id=Google.Chrome -e & winget install --id=Obsidian.Obsidian -e
    

    Best Regards,

    Ian Xue


    If the Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. trello 20 Reputation points
    2023-08-03T13:14:59.12+00:00

    Ah cool thx for the help. The difference between && and & is the key. Seems I got level up my cmd skills. After you gave me the solution I looked a bit more into it and here is a summary of some useful commands: https://stackoverflow.com/questions/28889954/what-does-do-in-this-batch-file

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.