Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8223875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:51:59+00:00 2026-06-07T14:51:59+00:00

I am trying get the parent folder of a Windows user’s profile path. But

  • 0

I am trying get the parent folder of a Windows user’s profile path. But I couldn’t find any “parameter” to get this using SHGetSpecialFolderPath, so far I am using CSIDL_PROFILE.

Expected Path:

Win7 – “C:\Users”

Windows XP – “C:\Documents and Settings”

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T14:52:01+00:00Added an answer on June 7, 2026 at 2:52 pm

    With the shell libary version 6.0 you have the CSIDL_PROFILES (not to be confused with CSIDL_PROFILE) which gives you what you want. This value was removed (see here), you have to use your own workaround.

    On any prior version you’ll have to implement your own workaround, such as looking for the possible path separator(s), i.e. \ and / on Windows, and terminate the string at the last one. A simple version of this could use strrchr (or wcsrchr) to locate the backslash and then, assuming the string is writable, terminate the string at that location.

    Example:

    char* path;
    // Retrieve the path at this point, e.g. "C:\\Users\\username"
    char* lastSlash = strrchr(path, '\\');
    if(!lastSlash)
      lastSlash = strrchr(path, '/');
    if(lastSlash)
      *lastSlash = 0;
    

    Or of course GetProfilesDirectory (that eluded me) which you pointed out in a comment to this answer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im trying to get the parent of this input but it just wont, i
I have been trying to get it to work using this thread but can't
Basically I am trying to get the gallery of parent page, and I've been
I am trying to get the index of child of its parent. For example:-
Trying to get a wildcard search to pick up on any text in org_name
Trying to get this expression to work, can someone look at it and tell
I am trying to get the index of the parent li and assign it
I'm trying to get my horizontal rule to ignore the parent padding. Here's a
I have a parent node and I'm trying to get each child node under
i am trying to create thumbnails. my path to original folder is: suppose I:\my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.