title: How to use NPM config variables cross platform (win/linux)?
body: <p>When using <code>npm_package_config_&lt;variable&gt;</code> usage is different per OS.</p>
  
  <p><strong>package.json (Linux &amp; Windows)</strong></p>
  
  <pre><code>config: {
      foo: "bar"
  }
  </code></pre>
  
  <p>Then for usage:</p>
  
  <p><strong>Linux</strong></p>
  
  <pre><code>node app.js --arg=$npm_package_config_foo
  </code></pre>
  
  <p><strong>Windows</strong></p>
  
  <pre><code>node app.js --arg=%npm_package_config_foo%
  </code></pre>
  
  <p>Thus I create 2 seperate <code>scripts</code> in my <code>package.json</code> but this feels cumbersome.</p>
  
  <p>Any way to get this cross-platform?</p>
  
  <p><em>P.S. I'm aware of the <a href="https://www.npmjs.com/package/cross-env" rel="noreferrer">cross-env</a> plugin, but this does not work for the above case, only for NODE_ENV.</em></p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>To avoid misinterpretation of the context, here is a real case scenario I'm looking for, to use this for Docker commands to specify port numbers:</p>
  
  <p><strong>package.json</strong></p>
  
  <pre><code>"config": {
      "port": "3000"
  }
  ...
  "scripts": {
      "docker:build": "docker build --build-arg PORT=$npm_package_config_port -t my-app .",
      "docker:build:win": "docker build --build-arg PORT=%npm_package_config_port% -t my-app .",
  }
  </code></pre>