black~cobra Posted March 19, 2004 Posted March 19, 2004 Hi guys,I would like to know how to start a ".cmd file" or how to execute a "command" (--> like "start /wait %cdrom%\install\program.exe /switch" from when i click on a button ?Let me explain: I am making an application in Delphi 7 that would install all the programs that i want, all unattended. I want to use Delphi 7 because that's what i learning in college now, i need your help on this one because my teacher is just a dumb guy that want is paycheck at the end of the week, he is not really good either , Here is what happen when i click on the button procedure TPost_Install.OkClick(Sender: TObject);begin ShowMessage('Post-Installation will install your selected applications); My problem is here--> How to call a file and execute it or execute a command ???end;And, the help file is no good too :/ Can you help me ?Thanks to anyone that can help me Black~Cobra
zivan56 Posted March 19, 2004 Posted March 19, 2004 ShellExecute(Handle ,'open', 'C:\install\program.exe', ' /switch'), nil, SW_SHOWNORMAL);Would run the program with a switch. You probably didnt learn it because it is a Windows API call, and therefore requires the shellapi in the uses section.
black~cobra Posted March 19, 2004 Author Posted March 19, 2004 ShellExecute(Handle ,'open', 'C:\install\program.exe', ' /switch'), nil, SW_SHOWNORMAL);Would run the program with a switch. You probably didnt learn it because it is a Windows API call, and therefore requires the shellapi in the uses section.Thanks alot for your response. I really appreciate it , but when i try to execute it , i get an error. :/ I added the "shellapi" in the uses section and your code in the code i posted in my first post and it comes up as an error saying : "not enought originals parameters" . Sorry if this doenst sound right, i use a french version of Delphi. Here the code that i added to my program:uses shellapi, Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls;procedure TPost_Install.OkClick(Sender: TObject);begin ShowMessage('Post-Installation will install your selected applications); ShellExecute(Handle ,'open', 'C:\aaw6.exe', ' /s'), nil, SW_SHOWNORMAL); end;Thanks again for your help !!Black~Cobra
zivan56 Posted March 19, 2004 Posted March 19, 2004 Remove the bracket in: ' /s')Its not supposed to be there. I must have typed it in accidently.
black~cobra Posted March 19, 2004 Author Posted March 19, 2004 Remove the bracket in: ' /s')Its not supposed to be there. I must have typed it in accidently.I love you zivan56 Its working !!! My little application is working like it should. :punk: Thanks alot for replying to my Questions Black~Cobra
zivan56 Posted March 19, 2004 Posted March 19, 2004 No problem, I'm glad to see people interested in learning Delphi
black~cobra Posted March 19, 2004 Author Posted March 19, 2004 No problem, I'm glad to see people interested in learning Delphi Last question , I promise ,how would i add the "start /wait" command to the code you gave me earlier ?I need that command line because all the application are trying to install at the same time ! And not like one at a time like I thought it should be ? Thanks again Black~Cobra
zivan56 Posted March 20, 2004 Posted March 20, 2004 Look at this site:http://delphi.about.com/library/weekly/aa082499.htmSpecifically under "Execute a program and wait until it has finished"Delphi.about.com is one of the best sites to learn Delphi from.
black~cobra Posted March 20, 2004 Author Posted March 20, 2004 Look at this site:http://delphi.about.com/library/weekly/aa082499.htmSpecifically under "Execute a program and wait until it has finished"Delphi.about.com is one of the best sites to learn Delphi from.Thanks again Have a good night Black~Cobra
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now