Solved

Run EXE file with parameter from DOS promt

Posted on 2000-04-24
8
258 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
ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 
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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Sending Gmail through Delphi 3 108
error 1.1 400 Bad request idhttp delphi 18 91
Delphi Form ownership 4 90
Performance of SQL statement 37 112
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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

803 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