%USERPROFILE% in File URI Link in Notepad++



  • I have this link in a text file in Notepad++:

    file:///C:/Users/john.doe/some_folder/test%20file.bat
    

    It uses the three slashes convention File URI Scheme to create a link in a text file in Notepad++

    If I double-click on this link, it runs the linked batch file.

    I want to change this link to:

    file:///%USERPROFILE%/some_folder/test%20file.bat
    

    This doesn’t work.

    Is there some character I can add or remove or escape to make it work?



  • Just wanted to add:

    Windows 10 here. Using Notepad++ 7.5.9 obtained from the Microsoft Store.

    %USERPROFILE% is a Windows environment variable.



  • @xmatic said in %USERPROFILE% in File URI Link in Notepad++:

    Using Notepad++ 7.5.9 obtained from the Microsoft Store.

    Don’t do this.

    As you’ve already discovered, Notepad++ doesn’t interpret “variables” such as these the same as Windows itself does. There is no workaround.



  • Thanks.

    (The only reason I’m using the Microsoft Store version is that this is a work laptop and I don’t have admin privileges to otherwise make a portable install of Notepad++ the default text file handler. But your point is noted.)


Log in to reply