You're right. Debug UserName() gives Travail (the admin one) and it's the same for GetEnvironmentVariable("USERNAME").
RunProgram("CMD") gives an admin windows command, and a direct launch of CMD from Windows gives an user Windows command.
Of course, if I launch from Windows CMD as admin (giving the password), I get the same result as RunProgram("CMD") in Purebasic.
The curious thing is that RunProgram("CMD") does not need admin password.
And the purebasic program is able to write under C:\Users\Travail\ (the admin one).
There is a security problem in my Windows 10 Pro. I am able to create a directory under C:\Users\Travail\ (the admin one) directly from Windows when I am logged with a normal user (jeanc).
Code: Select all
Debug "GetEnvironmentVariable('USERPROFILE')=" + GetEnvironmentVariable("USERPROFILE")
Debug "GetEnvironmentVariable('USERNAME')=" + GetEnvironmentVariable("USERNAME")
Debug "Username()=" + UserName()
RunProgram("CMD")
CMD launched from Purebasic gives admin environment variables:
CMD launched from Windows logged with normal user (jeanc) gives:
PureBasic 6.01 LTS 64 bit | Windows 10 Pro x64 | Intel(R) Core(TM) i7-8700 CPU @ 3.20Ghz 16 GB RAM, SSD 500 GB, PC locally assembled