OpenCode can show a Windows file path as plain text. To open the file from Windows Terminal, ask OpenCode for a Markdown link with a file:/// URL. We tested this with a Markdown file and a PNG image.
Ask OpenCode for a file link
- Ask OpenCode to return the absolute path as a Markdown link.
- Use forward slashes in the URL. Replace spaces in the path with
%20. - Hold Ctrl and click the rendered link in the OpenCode reply.
For example, the Windows path C:\Demo\Project Notes.txt becomes this Markdown link:
[Open project notes](file:///C:/Demo/Project%20Notes.txt)
Put the link in normal Markdown, not in a code block. This article shows the link as code because the example file is not on your computer.
Convert a path with PowerShell
Replace the example path with the full path to your file. PowerShell adds the file:/// prefix and encodes spaces.
$path = 'C:\Demo\Project Notes.txt'
([uri]$path).AbsoluteUri
To test a picture, use the full path to a PNG in your Pictures folder. Use the resulting URL as the link target.
If the link does not open
Check that the file exists on the computer that runs Windows Terminal. A path from a remote server or container may not exist on your Windows computer. If the link still fails, paste the original Windows path into the File Explorer address bar.
Summary
- Use a Markdown link with an absolute
file:///URL, not a plain Windows path. - Hold Ctrl and click the link in Windows Terminal.
- No OpenCode settings changed in our test. This procedure applies to the terminal interface we tested, not the web app.