I want to be able to click a Win11 desktop shortcut which then sets my copy buffer to a text string then starts an application (to have that string available to paste in the application).
The script so far is (last line for debugging):
Set-Clipboard -Value 'New Clipboard Buffer Text'
Start-Process -FilePath "C:\Program Files (x86)\Man From Uncle\Bob'sUrUncle.exe"
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
In the shortcut, I when I set the target to the .ps1 file, it just opens it in Notepad. If I set the target to
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe 'MyPSFile.ps1'
Then a Powershell window opens then immediately closes without anything being printing in it, and the application does not start.
Any idea what I should actually be doing?