Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

574
Vistas
how to run a simple node.js file using batch file

I have one simple "Hello World" program in Node.js. I want to run this using batch file.

var http=require("http");

http.createServer(function(request,response){
	response.writeHead(200,{'Content-Type':'text/plain'});
	response.end('Hello World!..\n');
}).listen(8080);
console.log('Server running at http://127.0.0.1:8080/');
I have used this batch file named 'new.bat'.

if not "%minimized%"=="" goto :minimized
set minimized=true
@echo off
start /min cmd /c "C:\Users\USER2\Desktop\webchat\server.js"
goto :EOF
:minimized

please help me.

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

You can try this code to create a batch file:

if not "%minimized%"=="" goto :minimized
set minimized=true
@echo off

cd "C:\app path"

start /min cmd /C "nodemon server.js"
goto :EOF
:minimized

to run node.js in background.

Instead of running your app like you are used to like node server.js, you can use nodemon: nodemon server.js

The most simple way you can imagine for a node package:

npm install -g nodemon
over 4 years ago · Santiago Trujillo Denunciar

0

server.js

var http=require("http");

http.createServer(function(request,response){
    response.writeHead(200,{'Content-Type':'text/plain'});
    response.end('Hello World!..\n');
}).listen(8080);
console.log('Server running at http://127.0.0.1:8080/');

new.bat enter image description here

if not "%minimized%"=="" goto :minimized
set minimized=true
@echo off
cd "C:\Users\USER2\Desktop\webchat"

start /min cmd /C "nodemon server.js"
goto :EOF
:minimized

Run the application in cmd: run the application in cmd after running the application in cmd the node.js command prompt will look like this.. the application running successfully now you can see the output in browser by setting localhost and the port

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda