Powershell: global tool doesn't accept the same parameters as the msi installed one.

Created on 15 Jan 2020  路  2Comments  路  Source: PowerShell/PowerShell

Steps to reproduce

  • Install PowerShell global tool by executing

dotnet tool install --global PowerShell

  • Install PowerShell msi

  • Execute the following:

c:\>pwsh -version

You get:
PowerShell 6.2.3

However if you invoke the global tool by executing:
c:\>c:\users\Jhon.Doe\.dotnet\tools\pwsh.exe -version

You get:

-version : The term '-version' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ -version
+ ~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (-version:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

The same thing occurs if you use any of the documented parameters on About pwsh

Expected behavior

Global tool to accept the same parameters as the msi installed one

Actual behavior

You get errors when trying to use documented parameters

Issue-Question

All 2 comments

I believe @adityapatwardhan has this fixed for the v7 release which is currently slated for next month if I'm not mistaken.

There is a v7-RC1 prerelease currently available, and we should have RC2 available shortly. You can install this version with:

dotnet tool install --global PowerShell --version 7.0.0-rc.1

@vexx32 . Thank you, you are right, this issue is fixed on PowerShell 7.0.0-rc.1.

With 7.0.0-rc.1 global tool, if you execute:

c:\>c:\users\Jhon.Doe\.dotnet\tools\pwsh.exe -version

You get:

PowerShell 7.0.0-rc.1

Was this page helpful?
0 / 5 - 0 ratings