Problem using system environment variables with the RUN command

2014-04-15
2014-05-17
  • Dave Harper
    Dave Harper
    2014-04-15

    Notepad++ v6.5.5; Windows 7 64-bit system

    In preparation for learning to write scripts I'm trying to get familiar with the RUN command and environment variables. I've created an extremely simple batch file called "test.bat" which contains the two lines "echo %1" followed by "pause" (so that the popup CMD window doesn't close until I press a key). In the Notepad++ RUN -> RUN popup window I select the batch file and add an environment variable so that the complete line looks like "C:\temp\test.bat $(FILE_NAME)". When I click on the run button, I get the expected output of "test.bat" echoed in the CMD window. This seems to work fine for any environment variables defined by Notepad++. However, when I try to access a system variable it doesn't work. In a DOS command window I can type "echo %PATH%" and I get a full listing of my current path. However, in the RUN command if I change it to "C:\temp\test.bat $(SYS.PATH)" all I get in the output window is the string "$(SYS.PATH)" instead of what it should evaluate to. This seems to be the case with all system environment variables. Looking at the writeups I've been following on the Wiki, I think the "SYS." syntax is correct yet I can't get things to work. Any ideas on what I'm doing wrong?

    Thanks,
    Dave

     
  • cchris
    cchris
    2014-05-17

    You need to write
    echo $(SYS.%PATH%)

    CChris

     
  • cchris
    cchris
    2014-05-17

    You need to write
    echo $(SYS.%PATH%)

    CChris