Skip to content
⌘ NSIS Forum Archive

User Name

4 posts

lordsathish#

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
jpderuiter#


Or use UserMgr plugin:
Afrow UK#
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