Hyperlink to a file? Win10



  • Is there a way to have a hyperlink to another file? Some searching would indicated the format:

    file://[filename]
    

    or

    file:////[filename]
    

    or

    file:///[filename]
    

    …should do the trick. NPP highlights the line, like it does with all other hyperlinks, but clicking on it does nothing–no error message, no random app opening. Just nothing.

    Any recommendations?

    Thanks.



  • @GarySe7en ,

    Use a full, correct file URL.
    if I have the following in Notepad++,

    file:///C:/Users/peter.jones/Downloads/TempData/nppCommunity/post19638.html
    

    and I double-click that, it opens that local file in my default browser.

    If you are unsure of the full, correct file URL for a given file, browse to that file in Windows Explorer normally, drag into your browser (which should open the local file), then copy from the URL bar and paste into Notepad++. Close the browser tab with that file, so that you’ll know if the next step works. Double-clicking on that URL should now work – it does for me.

    If it doesn’t, you’ll have to provide more information. A screenshot showing the file correctly in browser; your Notepad++ ? menu’s Debug Info contents, maybe a screenshot of a new Notepad++ window with just the same URL as your browser screenshot shows, and anything else you think might help us help you.



  • If you are going to write html sites, then I advise you to find out what a relative and absolute path is.
    https://www.google.com/search?q=Relative+and+absolute+path



  • Example:

    css-html.png



  • @andrecool-68 ,

    Relative links work fine in HTML in a browser.

    The question was about the file:// URL protocol, and how Notepad++ handles that for double-clicking links in Notepad++ – not in a browser.

    This SO Answer gives more about what variants are and are not allowed in the file:// URL protocol, and links to the wikipedia page with even more info.



  • @PeterJones What exactly the author of the question wants is not clear at all. I have no gift of foresight))



  • @andrecool-68

    I would infer, from the original posting, that what is expected is that following the link would open the file in Notepad++, but that’s just a guess.



  • @Alan-Kilborn My crystal ball has low battery)))



  • Thanks for the responses. Sorry if it wasn’t clear.

    What I am looking for is the ability to, from a hyperlink in one text file, open another text file in NPP. For example, filename1.txt is a text note with link:

    file://filename2.txt
    

    Clicking on that opens filename2.txt in NPP. That is what I am looking for.

    It would appear I need the fully qualified path. This works:

    file:///C:/Users/[removed]/notebook/2020-08%20journal%20daily%20summary.txt
    

    Relative paths do not work for me. Neither of these work:

    file:///2020-08%20journal%20daily%20summary.txt
    file:///./2020-08%20journal%20daily%20summary.txt
    

    Either way, thanks for the suggestions. This was enough to get it to work for me, even though how it works doesn’t meet my needs–but that isn’t NPP problem, that a user case problem.

    Thanks again.

    Just for kicks, I tried this:

    mailto://some_random@email_address.com
    

    Which works most excellent.



  • @GarySe7en,

    Note: in Notepad++, you can select a path (whether relative or absolute, like c:\blah\file.txt or ..\blah\file2.txt, and right click and select Open File (equivalent to Edit > On Selection > Open File)… and Notepad++ will even allow c:/blah/file.txt, so if you select just the relative portion of the file:// URL, then you can open that file in Notepad++ quite easily.



  • @PeterJones said in Hyperlink to a file? Win10:

    you can select a path (whether relative or absolute, like c:\blah\file.txt or …\blah\file2.txt, and right click and select Open File

    Wow! This is great. Obviously, I’ve never noticed that before. But this certainly makes the ability to link notes significantly easier.

    I’ve given up on most note taking applications. Evernote, OneNote, even tried Joplin. But nothing has replaced a bunch of old fashioned text files, many of them now in markdown format, and replicated using NextCloud.

    NextCloud has a decent markdown editor for mobile. All workstations need nothing more than NPP (which is on all of my systems).

    Thanks again!


Log in to reply