Why doesn't SHGetKnownFolderPath return the customized path?

Raymond Chen

A customer reported that the SHGet­Known­Folder­Path function was not working correctly. They moved their Videos folder to a new location, but when they called SHGet­Known­Folder­Path, they got the old path rather than the new one.

A quick check of the code they provided showed why:

                      KF_FLAG_DONT_VERIFY |

Um, you’re passing the KF_FLAG_DEFAULT_PATH flag. That flag means “Tell me where this folder would have been if its location had never been customized.” Therefore, if you pass this flag, you have no right to complain that it’s returning a path different from the customized path. Because passing that flag means “I don’t want the customized path.”


Discussion is closed.

Feedback usabilla icon