NT Profile Paths: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
(Initial Release)
(No difference)

Revision as of 19:51, 3 December 2009

Author: Zinthose (talk, contrib)


Description

Simple implementation to retrieve the default path for user profiles.

Usage

    ${ProfilesDirectory} $0
    DetailPrint "Profiles Directory = $0"
    ; OutPut: Profiles Directory = C:\Documents and Settings

The Macro

## Windows 2000 and newer required.
## Retrieve the default path for user profiles.
    !define ProfilesDirectory `!insertmacro _ProfilesDirectory`
    !macro _ProfilesDirectory _OUTVAR
        !verbose push
        !verbose 0
        ReadRegStr ${_OUTVAR} HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" ProfilesDirectory
        ExpandEnvStrings ${_OUTVAR} ${_OUTVAR}
        !verbose pop
    !macroend