Archive: User Name


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


http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.2.9

Or use UserMgr plugin:
http://nsis.sourceforge.net/UserMgr_plug-in


Great that works, Thanks :)


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