Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get logged on userid

Status
Not open for further replies.

RPEN

Programmer
Aug 23, 2007
33
0
0
CA
How do I retrieve the userid of the currently logged on user? Do I use the Environ function? Then I need to hard code the location of the UserName variable in the env table?

Thanks
 
UserName = Environ("USERNAME")

Other arguments you may consider:

ALLUSERSPROFILE
APPDATA
AVENGINE
CLIENTNAME
CommonProgramFiles
COMPUTERNAME
ComSpec
FP_NO_HOST_CHECK
HOMEDRIVE
HOMEPATH
INCLUDE
INOCULAN
LIB
LOGONSERVER
NUMBER_OF_PROCESSORS
OS
Path
PATHEXT
PROCESSOR_ARCHITECTURE
PROCESSOR_IDENTIFIER
PROCESSOR_LEVEL
PROCESSOR_REVISION
ProgramFiles
SESSIONNAME
SystemDrive
SystemRoot
TEMP
TMP
USERDOMAIN
USERNAME
USERPROFILE
VS71COMNTOOLS
WecVersionForRosebud.FF0
windir




[thumbsup2] Wow, I'm having amnesia and deja vu at the same time.
I think I've forgotten this before.
 
Cool, thanks. I'll likely have more simple questions as I'm totally new to Windows based programming (if you can call it that). Long time mainframer here.
 
Just bear in mind that the variable, UserName = Environ("USERNAME"), is the Windows Network logon id. If the user id for the Mainframe App is different, then that variable wont work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top