Help: pwsh command won't take command-line arguments

(cross posted on stack overflow)

According to pwsh documentation, I should be able to pass command-line arguments but I am getting errors instead (both from a PS prompt and from a CMD prompt):

> pwsh -NoExit
-NoExit : The term '-NoExit' is not recognized as the name of a cmdlet, function, script file, or operable program.
...

> pwsh -NoLogo
-NoLogo : The term '-NoLogo' is not recognized as the name of a cmdlet, function, script file, or operable program.
...

> pwsh -h
-h : The term '-h' is not recognized as the name of a cmdlet, function, script file, or operable program.
...

> pwsh -Command "Write-host hello"
-Command : The term '-Command' is not recognized as the name of a cmdlet, function, script file, or operable program.
...

But this works:

> pwsh "Write-host hello"
hello

My pwsh version is 6.2.3.0

What is going on???

 

Did you try to run the pwsh executable with its complete path?

Yes, it looks like your installation is broken, please reinstall and check to see if it’s working.

Also, try using ‘/’ instead of ‘-’

[pre]> pwsh /nologo[/pre]

Thank you.

Why that? What difference would it make if the executable in front of the argument isn’t found?

Yeah I know, you are right, but just in case, that’s it.

Are you running the executable or a .bat file?

what is it showing when you do ?

pwsh --help
pwsh /?

It should give the possible options to use with it.

Nope:

PS> C:\Users\ericj\.dotnet\tools\pwsh.exe --help
At line:1 char:3
+ --help
...
Unexpected token 'help' in expression or statement.

PS> C:\Users\ericj\.dotnet\tools\pwsh.exe /?
/? : The term '/?' is not recognized as the name of a cmdlet, function, script file, or operable program.

PS> C:\Users\ericj\.dotnet\tools\pwsh.exe "write-host hello"
hello

Uninstalling and reinstalling did not work:

PS> dotnet tool uninstall --global PowerShell
Tool 'powershell' (version '6.2.3') was successfully uninstalled.
PS> pwsh
pwsh : The term 'pwsh' is not recognized as the name of a cmdlet, function, script file, or operable program.

PS> get-command pwsh
get-command : The term 'pwsh' is not recognized as the name of a cmdlet, function, script file, or operable program.

PS> dotnet tool install --global PowerShell
You can invoke the tool using the following command: pwsh
Tool 'powershell' (version '6.2.3') was successfully installed.

PS> get-command pwsh
CommandType Name Version Source
----------- ---- ------- ------
Application pwsh.exe 6.2.3.0 C:\Users\ericj\.dotnet\tools\pwsh.exe

PS> pwsh /nologo
/nologo : The term '/nologo' is not recognized as the name of a cmdlet, function, script file, or operable program.

PS> pwsh /?
/? : The term '/?' is not recognized as the name of a cmdlet, function, script file, or operable program.

PS> pwsh --help
Missing expression after unary operator '--'.
Unexpected token 'help' in expression or statement.

PS> pwsh "write-host hello"
hello

I don’t know what this is. I get powershell core here: GitHub - PowerShell/PowerShell: PowerShell for every system!

[quote quote=199334]I don’t know what this is. I get powershell core here: https://github.com/PowerShell/PowerShell

[/quote]
Thanks! Installing from the .msi on that page fixed my problem.

Kodi Download