lordsathish
4th May 2011 07:59 UTC
User Name
Hi Ppl,
I'm recently started using NSIS. I'm embedding another installer for which I have to pass few command line arguments. One of the argument that I have to pass is current login name or the user name. I couldn't find a constant that hold this value. In command prompt you will be able to get this value using the%username% command.
Is there any way I can get the current user name value ?
Thanks,
Sathish
lordsathish
4th May 2011 08:21 UTC
Great that works, Thanks :)
Afrow UK
4th May 2011 21:54 UTC
I would recommend using the GetUserName API over the environment variable. UserMgr probably calls it anyway but if you wish to avoid adding an additional plug-in to your installer, you can use the System plug-in (used by Modern UI anyway):
System::Call `advapi32::GetUserName(t .R0, *i ${NSIS_MAX_STRLEN} r1)`
# $R0 == username
Stu