title: VBScript Error "End of Statement" in .vbs File with SendKeys Method
body: <p>I am trying to resolve an error code in my VBScript file that is occurring in the code below when I use the send keys method. I am calling this .vbs file from a batch file that has a parameter that I store here as the variable filename. </p>
  
  <p>Here is my .vbs file: </p>
  
  <pre><code> Set args = WScript.Arguments
   arg1 = args.Item(0)
  
   Dim filename
  
   filename = ""&amp;arg1&amp;""
  
   WshShell.Run("C:\root\bin\root.exe")
   WshShell.AppActivate "Administrator: Command Prompt"
   WshShell.SendKeys ".x analysis.C"
   WshShell.SendKeys ".x double_gaus.C"
   WshShell.SendKeys "c1-&gt;SaveAs("&amp;filename&amp;.pdf")"
   WshShell.SendKeys ".q"
  
   WScript.Quit 1
  </code></pre>
  
  <p>The error code coming out of the command prompt window when the batch file proceesds into the .vbs file is:</p>
  
  <pre><code>C:\...\Root_VBS_Script_1.vbs(12, 46) Microsoft 
  VBScript compilation error: Expected end of statement
  </code></pre>
  
  <p>What is the problem in my code? And are there any other problems?</p>