How to read C:\Users\Public\ folder path in Windows language ?

Just starting out? Need help? Post your questions and find answers here.
hdt888
User
User
Posts: 57
Joined: Sun Jul 07, 2024 8:42 am

How to read C:\Users\Public\ folder path in Windows language ?

Post by hdt888 »

I want to clarify, does the Public folder name change across Windows languages ?

If so, how to read its path?.

Thank for help.
PB 5.x + 6.x + Win10. Feel the ...Pure... Power.
User avatar
NicTheQuick
Addict
Addict
Posts: 1527
Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:

Re: How to read C:\Users\Public\ folder path in Windows language ?

Post by NicTheQuick »

If I remember it right since Windows 10 paths like this and also "Program Files" are the same in all languages and are only translated in the Explorer and file choosers.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
Marc56us
Addict
Addict
Posts: 1600
Joined: Sat Feb 08, 2014 3:26 pm

Re: How to read C:\Users\Public\ folder path in Windows language ?

Post by Marc56us »

wrote: I want to clarify, does the Public folder name change across Windows languages ?
If so, how to read its path?.
yes and no,
It doesn't change depending on the language, but it can change because Windows isn't necessarily on C:
So always use system variables

Code: Select all

Debug GetEnvironmentVariable("public")
Tip: To find out about all system variables, the quickest way is to open a CMD window and type SET
You can also filter with findstr (/i = ignore case)

Code: Select all

C:\>set | findstr /i public
PUBLIC=C:\Users\Public
Same thing for Linux, but uses grep instead of findstr
:wink:
Quin
Addict
Addict
Posts: 1135
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

Re: How to read C:\Users\Public\ folder path in Windows language ?

Post by Quin »

You can also use SHGetKnownFolderPath with the FOLDERID_Public parameter.
https://learn.microsoft.com/en-us/windo ... folderpath
Fred
Administrator
Administrator
Posts: 18350
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: How to read C:\Users\Public\ folder path in Windows language ?

Post by Fred »

There is sample here: viewtopic.php?p=582115#p582115
hdt888
User
User
Posts: 57
Joined: Sun Jul 07, 2024 8:42 am

Re: How to read C:\Users\Public\ folder path in Windows language ?

Post by hdt888 »

There is one more folder I forgot to mention:
C:\Users\Default\

How to read it ?
PB 5.x + 6.x + Win10. Feel the ...Pure... Power.
Marc56us
Addict
Addict
Posts: 1600
Joined: Sat Feb 08, 2014 3:26 pm

Re: How to read C:\Users\Public\ folder path in Windows language ?

Post by Marc56us »

hdt888 wrote: Tue Sep 10, 2024 2:58 pm There is one more folder I forgot to mention:
C:\Users\Default\

How to read it ?

Code: Select all

Default_UserDir$ = GetPathPart( GetEnvironmentVariable("userprofile") ) + "Default\"
Debug Default_UserDir$
Think simple, think basic, no need API, Press F1 Key...
User avatar
mk-soft
Always Here
Always Here
Posts: 6320
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: How to read C:\Users\Public\ folder path in Windows language ?

Post by mk-soft »

Also a method to destroy the computer by fiddling around in folders where you don't have to look.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Post Reply