title: Cross-platform way to set environment variables *with spaces* in npm scripts
body: <p>I am developing a serverless NodeJS app and need to test it in offline mode.  I have an <code>npm</code> script in a <code>package.json</code> file that looks like this:</p>
  <pre><code>  &quot;scripts&quot;: {
      &quot;serve&quot;: &quot;cross-env AUTHORIZER='{\\\&quot;claims\\\&quot;:{\\\&quot;permissions\\\&quot;:\\\&quot;[view:accounts manage:accounts]\\\&quot;,\\\&quot;sub\\\&quot;:\\\&quot;auth0|5cfe0adce3c4c50ea072ea9f\\\&quot;}}' AWS_PROFILE=elit_nonprd serverless offline start -s dev --noAuth&quot;,
  ...
  </code></pre>
  <p>Note that there two permissions that need to be <strong>separated by a space</strong>.  Running <code>npm run serve</code> on Windows gives the following error:</p>
  <pre><code>&gt; @mypackage@1.0.0 serve C:\path
  &gt; cross-env AUTHORIZER='{\&quot;claims\&quot;:{\&quot;permissions\&quot;:\&quot;[view:accounts manage:accounts]\&quot;,\&quot;sub\&quot;:\&quot;auth0|5cfe0adce3c4c50ea072ea9f\&quot;}}' AWS_PROFILE=elit_nonprd serverless offline start -s dev --noAuth
  
  The filename, directory name, or volume label syntax is incorrect.
  events.js:288
        throw er; // Unhandled 'error' event
        ^
  
  Error: spawn manage:accounts]&quot;,&quot;sub&quot;:&quot;auth0|5cfe0adce3c4c50ea072ea9f&quot;}} ENOENT
      at notFoundError (C:\path\node_modules\cross-spawn\lib\enoent.js:6:26)
      at verifyENOENT (C:\path\node_modules\cross-spawn\lib\enoent.js:40:16)
      at ChildProcess.cp.emit (C:\path\node_modules\cross-spawn\lib\enoent.js:27:25)
      at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
  Emitted 'error' event on ChildProcess instance at:
      at ChildProcess.cp.emit (C:\path\node_modules\cross-spawn\lib\enoent.js:30:37)
      at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12) {
    code: 'ENOENT',
    errno: 'ENOENT',
    syscall: 'spawn manage:accounts]&quot;,&quot;sub&quot;:&quot;auth0|5cfe0adce3c4c50ea072ea9f&quot;}}',
    path: 'manage:accounts]&quot;,&quot;sub&quot;:&quot;auth0|5cfe0adce3c4c50ea072ea9f&quot;}}',
    spawnargs: [
      'AWS_PROFILE=elit_nonprd',
      'serverless',
      'offline',
      'start',
      '-s',
      'dev',
      '--noAuth'
    ]
  }
  </code></pre>
  <p>This also happens if I replace <code>cross-env</code> with <code>cross-env-shell</code>, although the stack-trace is not shown.</p>
  <p>Is there a common cross-platform way to set environment variables when the values contain spaces?</p>
  <p><strong>Update</strong>: the outcome I am hoping for is to set <code>AUTHORIZER</code> to the following value (thanks to @RobC for requesting clarification):</p>
  <pre><code>{
    &quot;claims&quot;:
    {
      &quot;permissions&quot;: &quot;[view:accounts manage:accounts]&quot;,
      &quot;sub&quot;: &quot;auth0|5cfe0adce3c4c50ea072ea9f&quot;
    }
  }
  </code></pre>