I’d like to create a hyperlink to a text file in a Powershell script that’ll be run in Windows terminal. I’ve made it work by hardcoding the link, ex. file://c:/textfile.txt but I’d like to compile it from variables and I can’t figure out how to change the backslashes to forward slashes. Here’s what I’ve tried:
$CurrentFolder = (Get-Location).Path
$settingsFile = "textfile.txt"
$settings = Join-Path $currentFolder $settingsFile
$settingsLink = "file://$settings"
That produces this, which doesn’t work: file://C:textfile.txt