Home > Back-end >  Argo CD CLI error when installing on Windows 10 via powershell
Argo CD CLI error when installing on Windows 10 via powershell

Time:01-26

I'm trying to install ArgoCD CLI on my windows 10 PC by following the command from the website substituting the version but receive the below error. It does not seem to like the operator? Can anybody assist?

PS C:\Users\dell.docker> $url = "https://github.com/argoproj/argo-cd/releases/download/" v2.2.3 "/argocd-windows-amd64.exe"

At line:1 char:66
  ...  = "https://github.com/argoproj/argo-cd/releases/download/"   v2.2.3  ...
                                                                   ~
You must provide a value expression following the ' ' operator.
At line:1 char:67
  ... ps://github.com/argoproj/argo-cd/releases/download/"   v2.2.3   "/arg ...
                                                             ~~~~~~
Unexpected token 'v2.2.3' in expression or statement.
      CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
      FullyQualifiedErrorId : ExpectedValueExpression

CodePudding user response:

You must quote the version number:

$url = "https://github.com/argoproj/argo-cd/releases/download/"   'v2.2.3'   "/argocd-windows-amd64.exe"

Of course, you can also use only one quoted string to begin with, which - due to use of an expandable (double-quoted) string ("...") - would even work if the version number were provided via a variable:

$version = 'v2.2.3' # Quoting is required here too - '...' is a verbatim string
$url = "https://github.com/argoproj/argo-cd/releases/download/$version/argocd-windows-amd64.exe"

It does not seem to like the operator

It's not the operator that's the problem, it's the use of what you intend to be a string literal - v2.2.3 - without quoting.

Operators operate in the context of expressions in PowerShell (expression mode), and in expressions all string literals require quoting.

By contrast, only when you pass arguments to commands (argument mode) may you pass string values (without spaces and other metacharacters) without quoting:

Write-Output v2.2.3  # OK - quoting optional

See the conceptual about_Parsing help topic for more information about these two fundamental parsing modes.

  •  Tags:  
  • Related