NT Profile Paths: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
(Initial Release)
 
Line 19: Line 19:
         !verbose push
         !verbose push
         !verbose 0
         !verbose 0
         ReadRegStr ${_OUTVAR} HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" ProfilesDirectory
         ReadRegStr ${_OUTVAR} HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" ProfilesDirectory
         ExpandEnvStrings ${_OUTVAR} ${_OUTVAR}
         ExpandEnvStrings ${_OUTVAR} ${_OUTVAR}
         !verbose pop
         !verbose pop

Revision as of 19:52, 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} HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" ProfilesDirectory
        ExpandEnvStrings ${_OUTVAR} ${_OUTVAR}
        !verbose pop
    !macroend