Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does command prompt script close when checking npm version?

I have a file npm_version.cmd that does not pause and instead closes the window:

npm -v
@pause

I have a similar file nodejs_version.cmd that does pause and keeps the window open:

node -v
@pause

It seems npm is changing the window to npm and then back to cmd or something.

Any idea how to force this to pause?

like image 573
Craig Avatar asked May 04 '26 17:05

Craig


1 Answers

bceause npm itself is a bat (or cmd) file.

try with :

call npm -v

you are hitting this case

like image 162
npocmaka Avatar answered May 06 '26 07:05

npocmaka