10

I want to change the install path of winget (the package manager for windows) to D:\Program Files\{insert folder name}. This is the command I was told to use on the documentation

winget install --id {insert program id} --location "D:\Program Files\{insert folder name}"

But instead it installs the file in D:\Program

So what I understood is it reads the location up to the space and creates the folder until there. To make sure I used a folder name without space and it installed correctly.

I posted this question on StackOverflow initially but it got flagged as computer hardware/software and told me to post it here, how does this come under that?

2 Answers 2

14

This feature is proposed in Can the software installation path be set? #489.

The answer on Jul 11, 2020 was:

There is already a function in Winget, use winget install Software.Name --location "C:\Folder\Software.Name"

However the support is limited right now.

BUT, we also just got support for Interactive mode winget install Software.Name -i, which is a safer option then --location right now.

The location option is new and is likely to have bugs, and it seems that you have found one.

The best solution is perhaps to wait for this to be fixed, and to add a bug report to https://github.com/microsoft/winget-cli/issues.

If the -i solution is not an option, you might as temporary workaround move manually the contents of the folder on C to D and replace the C folder by a symbolic link to the D folder.

For more information see The Complete Guide to Creating Symbolic Links (aka Symlinks) on Windows.

6
  • It now works as expected.
    – not2qubit
    Commented Nov 8, 2022 at 2:11
  • if supported (learn.windows.com) (a gotcha for N00bs), suspect some application developers want installation in specific location.
    – dank8
    Commented Feb 5, 2023 at 4:22
  • 1
    Does not work for all programs. Some install to c:\program files which is a pain for those of us with small C drives and large external drives, as it's not easy to alias those internal windows install programs.
    – lonstar
    Commented Sep 13, 2023 at 12:59
  • how-to-geek link is dead
    – not2qubit
    Commented Dec 7, 2023 at 3:58
  • @not2qubit: Thank you - the link was replaced from archive.org.
    – harrymc
    Commented Dec 7, 2023 at 8:50
2

you can use "Progra~1" for "Program Files" and "Progra~2" for "Program Files (x86)". this is an error caused by powershell or cmd syntax, and not because of winget. You need to convert your path to any form without spaces or any special characters, that should be a regular habit, if you don't want to face these kind of issues.

5
  • Avoid posting answers to old questions that already have well received answers unless you have something substantial and new to add.
    – Toto
    Commented Jan 17, 2023 at 21:40
  • 3
    Using quotes didn't solve my issue and I used "Progra~1" to solve it, and this was the missing answer for this question. I think this is something new, right?
    – NJT145
    Commented Jan 23, 2023 at 19:48
  • Well, it is actually winget's fault. WinGet needs to properly quote the install dir argument, which it does for Burn, Msi, Wix and Inno format install packages (and probably some others), but NOT for Nullsoft installers. See here: github.com/microsoft/winget-cli/blob/master/src/… Also, while using 8.3 names can be a quick & dirty workaround, you have to be really cautious with that. 8.3 can be disabled and the numbers aren't stable. (i.e. "Program Files" could be "PROGRA~2" or "PROGRA~4"). Never script winget with 8.3 names! Commented Jan 30, 2023 at 22:24
  • 2
    This seems like something substantial to add. Up/down votes are supposed to take care of determining whether an answer is helpful. Why discourage potentially helpful input? Commented Feb 16, 2023 at 19:07
  • Instead of guessing which name the folder has in 8.3 format, you always can use "dir * /x" This shows all file and folder names within the current directory in 8.3 format.
    – AlexS
    Commented Nov 18, 2023 at 9:13

You must log in to answer this question.

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