Solved

Run EXE file with parameter from DOS promt

Posted on 2000-04-24
8
256 Views
Last Modified: 2010-04-04
Hi expert, I belive you can answer my question.

I wan run a application with parameter from dos promt. Example:
I have application extract zip file with name extract.exe
C:\extract abc.dbf

I want extract just for abc.dbf file
so How to send the parameter abc.file to delphi ?
0
Comment
Question by:iwan_m
8 Comments
 
LVL 6

Accepted Solution

by:
DrDelphi earned 200 total points
ID: 2743264
Hmmmm... if your question is how to get the Delphi application to accept the commandline parameter then this will do it for you:

Procedure MainFormCreate(Sender:TObject)
var Myfile:string;
begin
  If paramcount>0 then
  begin
   Myfile:=Paramstr[1];
   /// extraction code here using Myfile
  end;
end;



Good luck!!
   
 
0
 
LVL 7

Expert Comment

by:Motaz
ID: 2743287
DrDelphi is right, but he forget to use () instead of [], so it must be:
ParamStr(1), ParamStr(2)...

for i:= 1 to ParaCount do
  ShowMessage(ParamStr(i));

Motaz
0
 
LVL 6

Expert Comment

by:DrDelphi
ID: 2743299
Oops... my bad! <g>
0
 
LVL 7

Expert Comment

by:Motaz
ID: 2743309
by the way DrDelphi what is the meaning of <g> ?
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 9

Expert Comment

by:ITugay
ID: 2743499
Hi all.
Hi Iwan,

If you want to call external DOS application with parameters from your  Delphi application then:

-----------
uses ...., ShellApi, .....

procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
   ShellExecute(handle,'open','command','/c pkunzip abc.zip abc.dbf',nil,SW_SHOW);
end;
-----------

Sorry if I'm wrong.
-----
Igor.
0
 
LVL 6

Expert Comment

by:DrDelphi
ID: 2743656
<g> =Grin
<s> =Smile
<wthhtmpdc>= What The Hell Happened To My Precious Delphi Code? <g>

0
 
LVL 4

Expert Comment

by:Radler
ID: 2745720
Is a great detour, but if you try
http://www.geocities.com/SiliconValley/Orchard/8607/
The recommended component is really easy to use.

T++, Radler.
0
 

Author Comment

by:iwan_m
ID: 2746459
Hello DrDelphi's

Thank a lot for your answer.

I amazing with your simple  program and It's program can work.

I give you 200 point.

God Bless u.

:) Iwan_mulyawan@yahoo.com
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now