title: Sovled: Powershell - How to store arguments to a variable and use it?
body: <p>I have written a CMD script for batching atlas packs, and it works fine.</p>
  
  <h1>CMD Script</h1>
  
  <pre><code>set OutputDir=%1
  set MaxSize=%2
  set Scale=%3
  
  set TpCmd=--format unity-texture2d --smart-update --max-size %MaxSize% --scale %Scale%
  TexturePacker %TpCmd% --data "%OutputDir%.tpsheet" --sheet "%OutputDir%.png" "D:\xxx"
  </code></pre>
  
  <p>.<br>
  .<br>
  Recently I am learning PowerShell and try to write a script that could works like above.</p>
  
  <h1>PowerShell Script</h1>
  
  <pre><code>$AtlasMaxSize = 4096
  $AtlasScale = 0.5
  
  function Pack-Atlas($FileName) {
      $AtlasOptions = --format unity-texture2d --smart-update --max-size $AtlasMaxSize --scale $AtlasScale
      TexturePacker $AtlasOptions --data "$FileName.tpsheet" --sheet "$FileName.png" "D:\xxx"
  }
  </code></pre>
  
  <p>.<br>
  .<br>
  But it seems not a correct way for declaring the $AtlasOptions variable.<br>
  I think maybe need some way to store the options, could someone help me or provide some keywords?
  .<br>
  .<br>
  .<br>
  .<br>
  .   </p>
  
  <h1>Update</h1>
  
  <p>Thanks for @gvee and @TobyU<br>
  I have edited the script.
  .  </p>
  
  <pre><code>function Pack-Atlas($FileName, $AtlasMaxSize, $AtlasScale) {
      $AtlasOptions = "--format unity-texture2d --smart-update --max-size $AtlasMaxSize --scale $AtlasScale"
      TexturePacker $AtlasOptions --data "$FileName.tpsheet" --sheet "$FileName.png" $TargetPath
  }
  </code></pre>
  
  <p>But it seems not work.
  That's the error message I got:</p>
  
  <p>TexturePacker:: error: Unknown argument<br>
  --format unity-texture2d --smart-update --max-size 4096 --scale 0.5 - please check parameters or visit <code>http://www.codeandweb.com/texturepacker</code> for newer version</p>