How to execute dos commands in the app

Hi I'd like to be able to execute cos commands in an app through a memo1

like I put in what I'd like to do and then press begin and it will begin.

like making folders
mkdir tempp
and executing dos files code lines.

etc..
LVL 5
eNarcAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

BdLmCommented:
do you know the command shell execute and createprocress ....

http://www.delphipraxis.net/post489910.html

btw: delphi offers comand for create a directory, why to use that old stuff ???
0
BdLmCommented:
sample for shellexecute eg. open notepad ...  ( see the link in the code below)

unit Unit1;
{***************+
 *  ->  http://www.latiumsoftware.com/en/delphi/00002.php
 *
 ****************}
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs,
  shellapi, StdCtrls;
 
type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;
 
var
  Form1: TForm1;
 
implementation
 
{$R *.dfm}
 
procedure TForm1.Button1Click(Sender: TObject);
begin
    ShellExecute(Form1.Handle, nil, 'c:\winnt\notepad.exe',
  nil, nil, SW_SHOWNORMAL);
end;
 
end

Open in new window

0
electrodude102Commented:
uses
shellapi

ShellExecute(Application.Handle,'Open',PChar('cmd.exe'),'/c ipconfig /renew','',SW_HIDE);

just replace "ipconfig /renew" with your command
0
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

electrodude102Commented:
wait,
you want to type something(s) in a memo and run that command like a dos command?
i think i know what you mean i attached an example.

open a new project,
 add a memo and a button, and add shellapi to uses
 then add this code on the button's on click event
memo1.Lines.SaveToFile('temp.cmd');
ShellExecute(Handle, 'open', 'temp.bat', nil, nil, SW_HIDE) ;
DeleteFile('temp.bat');

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BdLmCommented:
but beside shellexecute  all the functions you need you can execute directly fro m delphi   http://www.delphibasics.co.uk/RTL.asp?Name=CreateDir
 
 
0
eNarcAuthor Commented:
thxs I'll have a tester :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.