Archive: how to get $(USER)


how to get $(USER)
Hello,

During installation I want to modify the file in

c:/Documents and Settings/LOGIN-NAME/Local Settings/Application Data/Microsoft/VisualStudio/7.1/VCComponents.dat

where Developer Studio stores include paths.


How can I determine the user, that is the LOGIN-NAME
part in the above path?
I first thought that the environemnt variable $(USER)
was known, but that is not the case.

thanks,

andreas


The value of the APPDATA environment variable with get you most of the path you are after.


Is LOGIN-NAME the user who is running the installation process?
If yes then the following (straight out of the System Plugin documentation) will give you the username:

System::Call "advapi32::GetUserName(t .r0, *i ${NSIS_MAX_STRLEN} r1) i.r2"
DetailPrint "User name - $0"

:)
CF

The login name if changed does not match the users directory, use the $APPDATA or $LOCALAPPDATA variable