Is there any environment variable or Other format that the profile path is represented in Windows? I want to query in such a way that I should get the value "C:\Documents and Settings (if windows XP or 2k3) or C:\users (If vista or windows 7).
I dont want the current user name appended to the string, which I can get thru %USERPROFILE% variable.
It is a just a link pointing to the new locations. All user's profiles are located under C:\users. Here you can find your Desktop, Documents, etc. If you need to see the C:\Documents and Settings link, first you have to enable “Show hidden files and folders” from the Folder Options in Windows Explorer.
You may find that folder's contents in 'C:\Users\YourUserID\AppData\Local' folder in Windows 10.
Select Start, select Control Panel. double click System, and select the Advanced tab. Click Environment Variables. In the section System Variables, find the PATH environment variable and select it.
The Windows System folder. A typical path is C:\Windows\System32. The Windows directory or system root. This corresponds to the %WINDIR% or %SYSTEMROOT% environment variables.
It doesn't exist. Instead, try %USERPROFILE%\..
Warning: as @Mark suggests, this is not reliable because the user profile directory may really be any arbitrary location.
On Vista+ you can use FOLDERID_UserProfiles to get C:\Users (or whatever it may be in localized versions, etc). On XP and earlier you'll pretty much have to go the CSIDL_COMMON_DESKTOPDIRECTORY route that will give you "C:\Documents and Settings\All Users\Desktop" and work your way back from there.
I think this settles it for Vista. For XP the solution is not perfect, but at least it won't depend on the current user's profile path. "All Users" will always exist, and I can't think of a reason for it to be in a place other than the default.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With