Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How to start an command or cmd file in delphi 7 ?

Featured Replies

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 :rolleyes:

Black~Cobra


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.

  • Author
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

Remove the bracket in:

' /s')

Its not supposed to be there. I must have typed it in accidently.

  • Author
Remove the bracket in:

' /s')

Its not supposed to be there.  I must have typed it in accidently.

I love you zivan56 :rolleyes:

Its working !!! My little application is working like it should.

:punk:

Thanks alot for replying to my Questions :)

Black~Cobra

  • Author
No problem, I'm glad to see people interested in learning Delphi  :D

Last question , I promise :rolleyes: ,

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

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.