npm / npm/cli

On windows generated *.cmd file overwrites console window title

Open
#4,239 2 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Needs Triage platform:windows Release 8.x
Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

With npm 8.3.1 the *.cmd file generated to run node applications overwrites the current console window title, setting the title to c:\Windows\system32\cmd.exe (the value of the %COMSPEC% environment variable) on exiting the application.

Sample of generated command file:

@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0

IF EXIST "%dp0%\node.exe" (
  SET "_prog=%dp0%\node.exe"
) ELSE (
  SET "_prog=node"
  SET PATHEXT=%PATHEXT:;.JS;=;%
)

endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%"  "%dp0%\node_modules\npm-test-cmd\npm-test-cmd.js" %*

This is extremely annoying if you have various console windows open and have set titles to help distinguish between them.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue provides a generated Windows .cmd sample but no repository file or test path. Reproduce the title change on Windows with the npm 8.3.1-style script, then trace where npm generates this command file. Done means running a generated script no longer changes the existing console window title after the application exits.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.