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

275
Visualizações
Directly use Batch file output as nodejs variable without using txt

what I'm doing now is make a txt file using batch file output

@echo off
set fname=Logan
set lname=Anderson
set gender=male
echo %fname%>>1.txt
echo %lname%>>1.txt
echo %gender%>>1.txt

Then read that txt using nodejs and use those as nodejs input, but what I want is if it is possible to use batch file output as nodejs input without using this txt file, directly call "nodejs compiled project using pkg" exe file with variables from batch

such as, In batch file

@echo off
set fname=Logan
set lname=Anderson
set gender=male
start "" "mycompiledproject.exe" "%fname%" "%lname%" "%gender%"
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

To use command line arguments in node, you need to use process.argv (here is the documentation for it: https://nodejs.org/docs/latest/api/process.html#process_process_argv)

So in your case, your node.js code should look something like this:

const process = require('process');

process.argv.forEach(function(value, index, array){
    //value will be the argument(s), index is there position,
    //and array is the entire array they are in. this function 
    //is called for each value.
});

once you turn this to exe, it should run in your batch just fine.

over 4 years ago · Santiago Trujillo 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