How do I pass a literal forward slash into Node.js in Git Bash for Windows?
<p>I'm using Git Bash for Windows (as in, I right-click in some directory and select "Git Bash here" from the context menu). Node.js v5.10.1.</p>

<p>Here's my complete Node.js script, <code>example.js</code>:</p>

<pre><code>console.log(process.argv);
</code></pre>

<p>Here's my command line and the output:</p>

<pre><code>$ node example.js "https://example.com"
[ 'C:\\...\\node.exe',
  'C:\\...\\example.js',
  'https:\\example.com' ]
</code></pre>

<p>Notice how the input argument "<a href="https://example.com" rel="noreferrer">https://example.com</a>" has <strong>two literal forward slashes</strong>, but the resulting string "https:\\example.com" has <strong>one literal backslash</strong>.</p>

<p>I have found that no amount of backslash-escaping (e.g. "https:\\/example.com") or additional forward slashes (e.g. "<a href="https:////////example.com" rel="noreferrer">https:////////example.com</a>") in the command line can stop this from happening. The result is <em>always</em> one literal backslash.</p>

<p>Using the same Node.js executable to run the same script from an ordinary Windows <code>cmd.exe</code> window does not cause this behaviour. Running an equivalent Python script from Git Bash for Windows <em>also</em> does not cause this behaviour.</p>

<h1>Update</h1>

<p>Watch this:</p>

<pre><code>$ node.exe -e "console.log(process.argv)" "https://example.com"
[ 'C:\\...\\node.exe',
  'https://example.com' ]

$ node -e "console.log(process.argv)" "https://example.com"
[ 'C:\\...\\node.exe',
  'https:\\example.com' ]
</code></pre>

<p>Why does removing ".exe" from the end of the call cause the slashes to reverse? I am using NVM 1.1.0, if that is relevant. <code>which node.exe</code> and <code>which node</code> return identical results, both pointing to that EXE file. There is no separate file named <code>node</code> in that directory. This happens on both Node.js 5.10.1 and Node.js 6.0.0.</p>