Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 03-27-2001, 09:27 PM
Mancubus Mancubus is offline
Senior Member
 
Join Date: Jan 2001
Posts: 275
Default How Can I run dos Commands without Writing a batch file?

How can I run DOS Commands, and pipe what it returns to a Text-file, without Writing and executing a batch file...


Cheers,
David
Reply With Quote
  #2  
Old 03-27-2001, 09:37 PM
dim47 dim47 is offline
Member
 
Join Date: Jul 2001
Posts: 55
Default RE: How Can I run dos Commands without Writing a batch file?

ExeName - name of program or command for execute
CmdLine - optional command line
WinName - window title

procedure TAbcPSForm.RunProcessAndWait(ExeName, CmdLine, WinName : String);
Var P : TProcessInformation;
I : TStartupInfo;
begin
FillChar(I, Sizeof(I), 0);
I.cb := sizeof(I);
I.lpTitle := @(WinName[1]);
if CreateProcess( PChar(ExeName), PChar(ExeName + ' ' + CmdLine),
Nil, Nil, FALSE, 0,
Nil, Nil, I, P) then
WaitForSingleObject(P.HProcess, INFINITE)
else
ShowMessage(SysErrorMessage(GetLastError));
end;
Reply With Quote
  #3  
Old 03-27-2001, 10:20 PM
Mancubus Mancubus is offline
Senior Member
 
Join Date: Jan 2001
Posts: 275
Default Huh?

What does thid mean?
how?
huh?
Give me an example...
with "ipconfig"

cheers,
dave
Reply With Quote
  #4  
Old 03-27-2001, 10:58 PM
dim47 dim47 is offline
Member
 
Join Date: Jul 2001
Posts: 55
Default RE: Huh?

You can call this function as:
RunProcessAndWait( 'ipconfig', 'ipconfig command line', 'IP Configuration command window' );
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 11:59 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2018, vBulletin Solutions, Inc.