I've just started using Inno Setup and I have come across a problem where I need to stop and start tomcat using the cmd. However, using the solution i am using is not working for some reason.
What I am trying to accomplish is to.
- Stop tomcat using "net stop tomcat6"
- Write a string to a xml-file in the tomcat folder.
- Start tomcat using "net start tomcat6"
The solution I am trying with is:
if Exec(ExpandConstant('{cmd}'), '/c net stop tomcat6', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
begin
Log('Result code is: ' + IntToStr(ResultCode));
SaveStringToFile(dirPage.Values[0] + '\conf\Catalina\localhost\' + inputPage.Values[0] + '.xml', GenerateXmlString(inputPage.Values[0], inputPage.Values[1], inputPage.Values[2],
inputPage.Values[3], inputPage.Values[4], inputPage.Values[5],
inputPage.Values[6]), False);
Exec(ExpandConstant('{cmd}'), '/c net start tomcat6', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
end
This however doesn't seem like the right way to go about this problem since is doesn't stop nor start the tomcat service.
These commands works perfectly if I write them manually in the cmd-window.
Sincerely,