The command below only works if I execute it from a Windows legacy cmd.exe prompt exactly like this:
powershell.exe -command "Write-Host -NoNewLine y ; sleep 2 ; Write-Host -NoNewLine y" | plink.exe ...
If I want to do the same thing from a PowerShell prompt, I have to do:
cmd /c powershell.exe -noprofile -command "Write-Host -NoNewLine y ; sleep 1 ; Write-Host -NoNewLine y" `| plink.exe ...
I'd like to know if there's a simpler & more streamlined way to do the same thing from a PowerShell prompt without breaking anything.
stdinyou should useSystem.Diagnostics.Process*.|character to be treated the same way it does under cmd.exe. I already posted the only two ways I could get the code working in the OP. successfully. I was just looking for a shorter way to do it than the "working" command-linea I posted in the OP.