title: Pass variable from batch to powershell
body: <p>I have a batch file that ask the user for a variable line <code>set /p asset=</code>. Im calling my powershell script like this </p>
  
  <blockquote>
    <p><code>SET ThisScriptsDirectory=%~dp0</code></p>
    
    <p><code>SET PowerShellScriptPath=%ThisScriptsDirectory%file.ps</code></p>
    
    <p><code>PowerShell -NoProfile -ExecutionPolicy Bypass -Command "&amp; '%PowerShellScriptPath%'";</code></p>
  </blockquote>
  
  <p>Im wondering how i send powershell the variable 'asset' from my batch file.</p>
  
  <p>Here is my .bat file content </p>
  
  <pre><code>@Echo off  
  cls
  Color E
  cls
  
  @echo Enter asset below
  set /p asset=
  
  @echo.
  @echo your asset is %asset%
  @echo.
  goto startusmt
  
  :startusmt
  @echo.
  @echo executing psexec ...
  @echo.
  
  SET ThisScriptsDirectory=%~dp0
  SET PowerShellScriptPath=%ThisScriptsDirectory%RemoteUSMT.ps1
  PowerShell -NoProfile -ExecutionPolicy Bypass -file %PowerShellScriptPath% %asset%
  psexec \\%asset% -u domain\username -p password cmd 
  
  goto EOF
  
  :EOF 
  PAUSE
  </code></pre>