Visual Studio 2022 Question

OSVBNET 1,386 Reputation points

Kind of strange question, but each time I install VS 2022 Pro, it's installed in a different registry location:


The ending string (KEY) changes with each install, need to update "DisplayName" value in a .bat file, after install, how to deal with that? :(

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,863 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Michael Taylor 51,071 Reputation points

    The value after Uninstall can be anything. The only requirement from Windows is that it is unique. Some apps use their names while other apps use a GUID that they have generated. It is not something you can code against.

    I'm not sure what you're trying to do exactly but if you want to find the VS installations then the preference is to use VSWhere. But if you must scan the registry then you'll need to look in all the subkeys. You'll need to do a fuzzy match on DisplayName to find the Visual Studio* entry(ies) and then you can rename from there. AFAIK there is no way to find the uninstall key otherwise as this is just standard Windows stuff.

    Alternatively you could probably use WMI to get the installed apps and get the registry key from there but you'll still end up doing a match against the product name, not the underlying registry key.