nsis

unable to read the path environment variables in nsis


have to get the path environment variables to notepad using nsis script. but i was getting an empty string with the following code

Section
Readregstr $0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path"
MessageBox MB_OK "test data path: $0"
SectionEnd

I tried with Readenvstr command, but I didn't got the fruitful result.


Solution

  • i have developed the batch script to get the path environment variables to txt file with the following code. Save & run the batch script through nsis Script

    batch code here
    @echo off
    set "output_file=%Temp%\path.txt"
    set "path_variable=%PATH%"
    echo %path_variable% > "%output_file%"