filesystem create a folder
Use std::filesystem::path for paths

C++17 gives you a canonical type to represent filesystem paths, so use that. This avoids having to create templates of all your functions. It also allows you to combine paths together in a portable way:

void folderLink(std::filesystem::path &amp;setDisplayName, std::filesystem::path &amp;getDisplayName)
{
    getDisplayName = setDisplayName / getDisplayName;
    ...
}


Use std::filesytem::create_directories()

This function will create the desired directory plus all its parent directories if they do not yet exist. Also, it will not report an error if the desired directory already exists. So you could write:

void foldersystem()
{
    std::filesystem::path folder_Documents = ...; // get known folder as a path here

    std::filesystem::create_directories(folder_Documents / "Microsoft" / "XP" / "Alpha");
    std::filesystem::create_directories(folder_Documents / "Microsoft" / "XP" / "Beta");
    std::filesystem::create_directories(folder_Documents / "Microsoft" / "Win7" / "Alpha");
    std::filesystem::create_directories(folder_Documents / "Microsoft" / "Win7" / "Beta");
}


Don't infinitely retry on errors

You are using a very weird pattern with infinite for-loops:

for(;;) {
    if (something_fails())
        continue;

    break;
}


If the thing you are trying to do fails, you are retrying it indefinitely. But if it fails once, why do you expect it will work the next time? The right thing to do at this point is just to return an error.

Prefer returning results instead of using output parameters

If a function returns something, return that instead of passing a reference to an output parameter. Combined with the use of std::filesystem::path, knownFolder() then becomes:

std::filesystem::path knownFolder(KNOWNFOLDERID fodlerID)
{
    PWSTR pszFolderPath;

    if (FAILED(SHGetKnownFolderPath(folderID, 0, nullptr, &amp;pszFolderPath)))
        throw std::runtime_error("Could not get known folder");

    std::filesystem::path result = pszFolderPath;
    CoTaskMemFree(pszFolderPath);
    return result;
}


Use an array of paths if you have many of them

If you have many paths to create, then store them in an array, and use a for-loop to create them all. Here is an example:

static const std::filesystem::path required_subdirectories[] = {
    "XP/Alpha",
    "XP/Beta",
    "Win7/Alpha",
    "Win7/Beta",
};

void foldersystem()
{
    std::filesystem::path folder_Documents = ...; // get known folder as a path here

    for (auto &amp;subdirectory: subdirectories) {
            std::filesystem::create_directories(folder_Documents / "Microsoft" / subdirectory);
    }
}


Note that using the forward slash is perfectly fine here; the std::filesystem functions understand this as a directory separator.