You don't show the error message. Pwsh defaults to -file while powershell defaults to -command. Running from cmd:
pwsh { 'hi there' }
The argument '{' is not recognized as the name of a script file. Check the spelling of
the name, or if a path was included, verify that the path is correct and try again.
pwsh -command { 'hi there' }
hi there
With start-process -nonewwindow you can see the error:
Start-Process -NoNewWindow pwsh.exe { Read-Host }
The argument 'Read-Host' is not recognized as the name of a script file. Check the
spelling of the name, or if a path was included, verify that the path is correct and try
again.
Usage: pwsh[.exe] [-Login] [[-File] <filePath> [args]]
[-Command { - | <script-block> [-args <arg-array>]
| <string> [<CommandParameters>] } ]
[-ConfigurationName <string>] [-CustomPipeName <string>]
[-EncodedCommand <Base64EncodedCommand>]
[-ExecutionPolicy <ExecutionPolicy>] [-InputFormat {Text | XML}]
[-Interactive] [-MTA] [-NoExit] [-NoLogo] [-NonInteractive] [-NoProfile]
[-OutputFormat {Text | XML}] [-SettingsFile <filePath>] [-SSHServerMode]
[-STA]
[-Version] [-WindowStyle <style>] [-WorkingDirectory <directoryPath>]
pwsh[.exe] -h | -Help | -? | /?
PowerShell Online Help https://aka.ms/powershell-docs
All parameters are case-insensitive.
"pwsh { 'hi there' } works within powershell. I'm not sure why.
.\echoargs { 'hi there' }
Arg 0 is <-encodedCommand>
Arg 1 is <IAAnAGgAaQAgAHQAaABlAHIAZQAnACAA>
Arg 2 is <-inputFormat>
Arg 3 is <xml>
Arg 4 is <-outputFormat>
Arg 5 is <text>
It seems to automatically run this?
pwsh -encodedCommand IAAnAGgAaQAgAHQAaABlAHIAZQAnACAA -inputFormat xml -outputFormat text