I hope I have not missed an obvious answer to this somewhere, but in case I have - I apologise.
System.Posix.User
feature a getLoginName
for finding the login name of the currently logged in user. Now, what would work for getting the same information on the Windows platforms?
As USERNAME environment variable contains the name of the user currently logged on in a windows system, you can use that to find out the username:
import System.Environment
main = getEnv "USERNAME" >>= print
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With