title: How to use Delphi to execute a .bat file properly
body: <p>I am running a .bat file from delphi(2010).</p>
  
  <pre><code>procedure TForm1.Button2Click(Sender: TObject);
  var sCmd: String;
   Begin
  sCmd := Pwidechar('b4a_c2dm.bat' +' ' +'send ' + Trim(Edit1.Text)+' '  + Trim(edit2.Text ));
  ShellExecute(0, 'open', 'b4a_c2dm.bat', PChar(sCmd), nil, SW_SHOWMAXIMIZED);
     end;
  </code></pre>
  
  <p>This opens the cmd.exe and passes the correct string in the cmd.exe , BUT</p>
  
  <p>Some how the line in the .bat file (java -cp b4a_c2dm.jar anywheresoftware.b4a.c2dm.C2DM %*)  is showing up in the cmd.exe window and not letting the .bat file do its job.</p>
  
  <p>Can someone help me with this.</p>