How to use Delphi to execute a .bat file properly

前端 未结 1 1260
我在风中等你
我在风中等你 2021-01-13 17:02

I am running a .bat file from delphi(2010).

procedure TForm1.Button2Click(Sender: TObject);
var sCmd: String;
 Begin
sCmd := Pwidechar(\'b4a_c2dm.bat\' +\' \         


        
1条回答
  •  孤城傲影
    2021-01-13 17:57

    In order to execute a batch file, the program to be called is 'cmd' and its parameter should be the name of the batch file.

    Regarding your program,

    ShellExecute (application.handle, 'open', 'cmd', PChar(sCmd), nil, SW_MAXIMIZE)
    

    0 讨论(0)
提交回复
热议问题