The Issue
Most of the time, when using scripting in Powershell, you have your file path export for example to say "$env:Temp\config1.yaml"
and you’ll have that dance with the terminal of trying to copy the text, it sometimes copying and sometimes not… Maybe its just me. So I though this MUST be possible right. Its just a time and resource query.
So I took to the interwebs and started searching as you do, Checking out Stack Overview, GitHub, and some All knowing AI (ChatGPT). During my investigation I found some interesting links from StackOverflow which made it look like it might be possible:
- https://stackoverflow.com/questions/15581012/how-to-render-clickable-link-using-powershell
- https://stackoverflow.com/questions/36293078/clickable-hyperlink-on-powershells-console-output#:~:text=Clickable%20links,%20when%20referring%20to%20the
The Solution
The second Stack Overflow Post, Found the answer that I needed using escape characters in PowerShell.
If you want to read more about the `e
character, You can check out the Microsoft Docs page Here
Pwsh Requirement - PowerShell 7.x
|
|
You can use both: Write-Output Write-Host
If you wanted to add some colour to your links:
|
|
Write-Host Examples
Magenta
White
Yellow