This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Hi, I'm trying to find a way to retrieve the username or home directory of the current user logged in to Windows. For those familiar with Python or it would produce a similar result to the below code sample:
#To get a username
>>> import getpass
>>> username = getpass.getuser()
>>> print(username)
someUser
#To get a user's home directory path
>>> homedir = os.path.expanduser("~")
>>> print(homedir)
C:\Users\someUser
I've searched the Lansa documentation, but haven't found a way to achieve something similar in Lansa. If someone could point me to the documentation for a similar function(one or the other) in Lansa, it would be greatly appreciated.
So, I found a way to do this in V13. While there is no way to grab it directly as with #XPRIM_OSUTIL in V14, what you can do is get it using the following code in V13:
But still a big thank you to tsupartono for providing exactly what I asked for originally. I look forward to using XPRIM_OSUTIL in our V14 environment.