Page 1 of 1

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

Posted: Tue Sep 10, 2024 11:40 am
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.

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

Posted: Tue Sep 10, 2024 11:52 am
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.

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

Posted: Tue Sep 10, 2024 12:04 pm
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:

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

Posted: Tue Sep 10, 2024 12:16 pm
by Quin
You can also use SHGetKnownFolderPath with the FOLDERID_Public parameter.
https://learn.microsoft.com/en-us/windo ... folderpath

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

Posted: Tue Sep 10, 2024 12:29 pm
by Fred
There is sample here: viewtopic.php?p=582115#p582115

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

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

How to read it ?

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

Posted: Tue Sep 10, 2024 3:39 pm
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...

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

Posted: Tue Sep 10, 2024 4:12 pm
by mk-soft
Also a method to destroy the computer by fiddling around in folders where you don't have to look.