Search code examples
node.jswindowsbatch-filenpm

How to set the title of a Windows console while npm is running?


I have started to develop a web application project on my Windows machine, for which I use npm, bower, and the nodejs HTTP server.

For easier start of the HTTP server, I created the batch file:

@echo off
title HTTP Server
npm start

npm start starts the http-server. For that I have the following entry in the packages.json:

"start": "http-server -a localhost -p 8000 -c-1"

But when I double click the batch, the title of the opening console window first changes to npm and then to bower. So it ignores my own title while npm/bower is running.

Since I have many console windows open, I would like to force the HTTP server console window to have my specific title. How can I achieve that?


Solution

  • Set the title in your package.json file:

    "start": "title HTTP Server && http-server -a localhost -p 8000 -c-1"