LOGINNAME and USERNAME do not match to Windows user profile.

LOGINNAME and USERNAME do not match to Windows user profile.

scot-65
Advisor Advisor
349 Views
3 Replies
Message 1 of 4

LOGINNAME and USERNAME do not match to Windows user profile.

scot-65
Advisor
Advisor

AutoCAD-LT 2024

Windows 11

 

Command: (getvar 'savefilepath)
"C:\\Users\\pwa_0\\appdata\\local\\temp\\"

 

Command: (getvar 'loginname)
"jpw"

 

Command: (getvar 'username)
"jpw"

 

What is the simplest way to locate the windows current user directory name?

From the example above, I am looking for "pwa_0".

getvar, getenv, registry, or VL(?).

I am trying to build support paths inside an installer LSP.

 

Thanks in advance.

 


Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes
350 Views
3 Replies
Replies (3)
Message 2 of 4

paullimapa
Mentor
Mentor

there's no (getvar 'username)

but (getenv "username") should get same results as (getvar 'loginname)

so in your example, I'm not sure how it's ever possible to get "pwa_0"

when you're logged in from Windows as "jpw"

FYI: you can use (getenv) to retrieve any of the SET variables done in DOS like:

(getenv"localappdata")

(getenv"userprofile")


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 3 of 4

scot-65
Advisor
Advisor

Paul,

 

Thank you for the heads up.

LocalAppData will need trimming for what I require.

UserProfile I can build from.

 

For W11 and R2024-LT, UserName can be accessed from both getvar and getenv.

 

Another promising method, but it does not work is LASTPROMPT.

Had this behaved correctly after a LSP/FAS drag-and-drop I would not be asking.

What would work is (getvar "SECONDTOTHELASTPROMPT").

 

Scot

 


Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes
Message 4 of 4

ronjonp
Advisor
Advisor

@scot-65 This should match your current username: (getenv "temp")

0 Likes