nodejs / help

:sparkles: Need help with Node.js? File an Issue here. :rocket:
1.47k stars 280 forks source link

process.argv not containing all supplied arguments when calling the file via file associations #4284

Closed spthiel closed 11 months ago

spthiel commented 11 months ago

Details

On windows: When associating .js files to node.exe I experience that all further arguments after the script name are stripped from process.argv So f.ex. as shown in this screenshot Screenshot from 2023-11-03 09-57-12 (test2.js contains just console.log(process.argv)) test2.js argument will omit the argument but node test2.js argument will not.

I believe I am misunderstanding how windows handles file associations but am wondering if there was a way around this issue

Node.js version

{ node: '20.9.0', acorn: '8.10.0', ada: '2.6.0', ares: '1.19.1', base64: '0.5.0', brotli: 1.0.9", cjs_module_lexer: '1.2.2', cldr: '43.1', icu: '73.2', llhttp: '8.1.1', modules: '115', napi: ‘9', nghttp2: 1.57.0", nghttp3: '0.7.0', ngtcp2: '0.8.1', openssl: '3.0.10+quic', simdutf: '3.2.17', tz: '2023c', undici: '5.26.3', unicode: '15.0', uv: '1.46.0', uvwasi: '0.0.18', v8: '11.3.244.8-node.16", zlib: '1.2.13.1-motley' }

Example code

console.log(process.argv)

Operating system

Microsoft Windows [Version 10.0.19045.2965]

Scope

runtime

Module and version

Not applicable.

spthiel commented 11 months ago

Solved by https://github.com/nodejs/node/issues/19576