Solved

Run EXE file with parameter from DOS promt

Posted on 2000-04-24
8
263 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 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
Technology Partners: 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

695 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