I am trying to start a Powershell window that starts an ssh session with the following command:
pwsh.exe -noexit -Command {ssh <username>@<host>}
This works when executed from a pwsh.exe window itself:
but when executed from cmd, the run window (Win+R) or Task Scheduler (what I need it for), it just displays the command that should have been executed and starts pwsh:
That is, the command that doesn't work outside of PowerShell is:
pwsh.exe -noexit -Command {ssh username@host}
The commands have of course been tested with actual websites where, again, 1 works and 2 doesn't.
Any help would be greatly appreciated! Thank you!