Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

775
Visualizações
ERROR: Invalid syntax. Default option is not allowed more than '2' time(s). Type "SETX /?" for usage

I am using Windows 10. In CMD, I tried to execute the following command in my electron project:

setx GH_TOKEN "ghp_B3kYZy7OibM1Rka4Y3jLSiBUlvtSS717FhvE" npm run publish

And I got this error:

ERROR: Invalid syntax. Default option is not allowed more than '2' time(s).
Type "SETX /?" for usage.

The following code is the part of content of the Package.json file:

"scripts": {
    "publish": "electron-builder build -w -p onTagOrDraft"
  }

In the tutorial I am watching, this command is entered in the Mac operating system as follows, where it works properly: enter image description here

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Use

setx GH_TOKEN "ghp_B3kYZy7OibM1Rka4Y3jLSiBUlvtSS717FhvE" && npm run publish

The && are necessary because there are two commands. Without the &&, the npm run publish will be passed as arguments to SETX

about 4 years ago · Juan Pablo Isaza Relatório

0

This error also occurs if the environment variable you're setting contains one or more spaces.

In this case, you may avoid the problem by enclosing the value in double quotes. Unlike SET, which would take the quotes to be part of the value, SETX excludes the quotes from your stored value.

The differences in space and quote handling by SET and SETX are shown in the examples below.

For SET with spaces, quotes are not needed (and if included, become part of the value):

Set a value                              View the value                              
-----------------------------            -----------------------------
C:\TEMP>set MYVAR=some value             C:\TEMP>set MY
                                         MYVAR=some value

C:\TEMP>set MYVAR="some value"           C:\TEMP>set MY
                                         MYVAR="some value"

For SETX with spaces, quotes are needed (and do not become part of the value):

Set a value                              View the value in a new window                      
-----------------------------            -----------------------------
C:\TEMP>SETX MYVAR some value
ERROR: Invalid syntax. Default option is not allowed more than '2' time(s).
Type "SETX /?" for usage.

C:\TEMP>SETX MYVAR "some value"          C:\TEMP>set MY
SUCCESS: Specified value was saved.      MYVAR=some value
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda