title: Running batch file in background with VBS, keep getting "file not found"
body: <p>I am trying to run a batch file hidden using VBS.
  I have searched high and low, but no matter what I do I just cannot get mine to work :(</p>
  <p>Here is my code:</p>
  <pre><code>If WScript.Arguments.Item(2) = &quot;TV&quot; Then
  Set WShShell = WScript.CreateObject(&quot;WScript.Shell&quot;)
  WShShell.Run &quot;extractscipt.bat &quot; &amp; chr(34) &amp; WScript.Arguments.Item(0) &amp; chr(34) &amp; &quot; &quot; &amp; chr(34) &amp; WScript.Arguments.Item(1) &amp; chr(34) &amp; &quot; &quot; &amp; chr(34) &amp; WScript.Arguments.Item(2) &amp; chr(34), 0
      Set WShShell = Nothing
  End If
  </code></pre>
  <p>The error I keep getting says &quot;file not found&quot;.</p>
  <p>My bat file in itself work flawlessly, I am only using this VB Script to hide the command window.
  Two of the arguments I am including is paths so I need them to be quoted :)
  I hope you can help me.</p>
  <p>This is the content of my extractscript.bat file:</p>
  <pre><code>set fromdir=%1
  set name=%2
  set label=%3
  set todir=F:\%name%
  
  if %label%==EXTRACT (
  if not exist %todir% mkdir %todir%
  &quot;C:\Program Files\7-Zip\7z.exe&quot; x &quot;%fromdir%\*.rar&quot; -o&quot;%todir%&quot;
  exit
  )
  exit
  </code></pre>
  <p>If you have any idea on how to combine the two files in one hidden program that would be accepted too ;)</p>
  <hr />
  <h1>EDIT/UPDATE</h1>
  <p>So it turns out I needed to add the full path, and I found some error in my code too. I didn't have to add the chr(34) ( &quot; ), that only messed it up :)
  Here is the working code I am using, in case someone need this answer too :)</p>
  <pre><code>If WScript.Arguments.Item(2) = &quot;TV&quot; Then
      Set WShShell = WScript.CreateObject(&quot;WScript.Shell&quot;)
      WShShell.Run &quot;&quot;&quot;C:\Program Files (x86)\uTorrent\extractscript.bat&quot;&quot; &quot;&amp; WScript.Arguments.Item(0) &amp; &quot; &quot; &amp; WScript.Arguments.Item(1) &amp; &quot; &quot; &amp; WScript.Arguments.Item(2), 0
      Set WShShell = Nothing
  End If
  </code></pre>