?
Solved

Run EXE file with parameter from DOS promt

Posted on 2000-04-24
8
Medium Priority
?
266 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 6

Accepted Solution

by:
DrDelphi earned 800 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Expert Comment

by:Motaz
ID: 2743309
by the way DrDelphi what is the meaning of <g> ?
0
 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

771 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