Solved

Run EXE file with parameter from DOS promt

Posted on 2000-04-24
8
257 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
code issue 8 100
FMX StringGrid1->Canvas->FillRect Problem 3 128
Delphi Seattle: Project Options : Version info for all platforms, all releases? 2 78
Printing problem 2 81
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

896 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

16 Experts available now in Live!

Get 1:1 Help Now