black~cobra Posted March 19, 2004 Share 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 Link to comment Share on other sites More sharing options...
zivan56 Posted March 19, 2004 Share 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. Link to comment Share on other sites More sharing options...
black~cobra Posted March 19, 2004 Author Share 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 Link to comment Share on other sites More sharing options...
zivan56 Posted March 19, 2004 Share Posted March 19, 2004 Remove the bracket in: ' /s')Its not supposed to be there. I must have typed it in accidently. Link to comment Share on other sites More sharing options...
black~cobra Posted March 19, 2004 Author Share 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 Link to comment Share on other sites More sharing options...
zivan56 Posted March 19, 2004 Share Posted March 19, 2004 No problem, I'm glad to see people interested in learning Delphi Link to comment Share on other sites More sharing options...
black~cobra Posted March 19, 2004 Author Share 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 Link to comment Share on other sites More sharing options...
zivan56 Posted March 20, 2004 Share 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. Link to comment Share on other sites More sharing options...
black~cobra Posted March 20, 2004 Author Share 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 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now