Friday, 20 October 2017
How to Run a .bat file using innosetup Installer
How to create shortcut too desktop using innosetup Installer
How to delete windows service using innosetup Installer
How to stop the window service using innosetup Installer
Assuming that in windows(windows 7 or Higher versions) operating system, we have created service or by default some application created a service.
Now we want to stop that service using Innosetup, The given below code to stop the service.
[Run]
Filename: {sys}\sc.exe; Parameters: "stop service_name" ; Flags: runhidden
Filename: {sys}\sc.exe; Parameters: "stop service_name" ; Flags: runhidden
This code should be place in RUN section of innosetup.
Example: Considered That you have installed Mysql and its working Good. Now you want to stop Mysql service by using innosetup. Considering service_name as mysql, The given below code to stop mysql
[Run]
Filename: {sys}\sc.exe; Parameters: "stop mysql" ; Flags: runhidden.
Filename: {sys}\sc.exe; Parameters: "stop mysql" ; Flags: runhidden.
How to check java run time environment installed or not
How to install java run time environment silently
[Files]
Source: "C:\Users\admin\Desktop\Dependies\jre-8u131-windows-i586.exe"; DestDir: "{tmp}"; DestName: "JREInstaller.exe"; AfterInstall: RunJavaInstaller();
[Code]
procedure RunJavaInstaller();
var
StatusText: string;
ResultCode: Integer;
Path, Parameters: string;
begin
Path := '{tmp}\JREInstaller.exe';
{ http://docs.oracle.com/javase/8/docs/technotes/guides/install/config.html#table_config_file_options }
Parameters := '/s INSTALL_SILENT=Enable REBOOT=Disable SPONSORS=Disable REMOVEOUTOFDATEJRES=1';
StatusText:= WizardForm.StatusLabel.Caption;
WizardForm.StatusLabel.Caption:='Installing the java runtime environment. Wait a moment ...';
WizardForm.ProgressGauge.Style := npbstMarquee;
try
if not Exec(ExpandConstant(Path), Parameters, '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
begin
{ we inform the user we couldn't install the JRE }
MsgBox('Java runtime environment install failed with error ' + IntToStr(ResultCode) +
'. Try installing it manually and try again to install MyProg.', mbError, MB_OK);
end;
finally
WizardForm.StatusLabel.Caption := StatusText;
WizardForm.ProgressGauge.Style := npbstNormal;
end;
end;
Source: "C:\Users\admin\Desktop\Dependies\jre-8u131-windows-i586.exe"; DestDir: "{tmp}"; DestName: "JREInstaller.exe"; AfterInstall: RunJavaInstaller();
[Code]
procedure RunJavaInstaller();
var
StatusText: string;
ResultCode: Integer;
Path, Parameters: string;
begin
Path := '{tmp}\JREInstaller.exe';
{ http://docs.oracle.com/javase/8/docs/technotes/guides/install/config.html#table_config_file_options }
Parameters := '/s INSTALL_SILENT=Enable REBOOT=Disable SPONSORS=Disable REMOVEOUTOFDATEJRES=1';
StatusText:= WizardForm.StatusLabel.Caption;
WizardForm.StatusLabel.Caption:='Installing the java runtime environment. Wait a moment ...';
WizardForm.ProgressGauge.Style := npbstMarquee;
try
if not Exec(ExpandConstant(Path), Parameters, '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
begin
{ we inform the user we couldn't install the JRE }
MsgBox('Java runtime environment install failed with error ' + IntToStr(ResultCode) +
'. Try installing it manually and try again to install MyProg.', mbError, MB_OK);
end;
finally
WizardForm.StatusLabel.Caption := StatusText;
WizardForm.ProgressGauge.Style := npbstNormal;
end;
end;
Subscribe to:
Posts (Atom)