I am trying to run a shell script from inno setup, but its failing. Here is my code:
procedure CurStepChanged(CurStep: TSetupStep);
var
ErrorCode: Integer;
cmdString: String;
begin
if (CurStep=ssInstall)
then
cmdString := 'net stop wuauserv';
Exec(ExpandConstant('{cmd}'), '/C ' + cmdString, '', SW_SHOW, ewWaitUntilTerminated, ErrorCode);
if (CurStep=ssPostInstall)
then
cmdString := 'net start wuauserv';
Exec(ExpandConstant('{cmd}'), '/C ' + cmdString, '', SW_SHOW, ewWaitUntilTerminated, ErrorCode);
if Exec(ExpandConstant('{cmd}'), '/c {tmp}/wsus.bat', '', SW_SHOW, ewWaitUntilTerminated, ErrorCode) then
if (CurStep=ssDone)
then
cmdString := 'wuauclt /resetauthorization /detectnow & pause';
Exec(ExpandConstant('{cmd}'), '/C ' + cmdString, '', SW_SHOW, ewWaitUntilIdle, ErrorCode);
end;
The first 2 appear to run fine, the last command fails, with the error:
'wuauclt' is not recognized as an internal or external command,
operable program or batch file.
Press any key to continue . .
Any suggestions? I believe its not setting the correct working directory, I've tried Exec(ExpandConstant('{win}'), Exec(ExpandConstant('{sys}') and Exec(ExpandConstant('{cmd}') to no avail.
this examplescript which performs search for updates and returns available update count when the setup starts. It's based onthis example. But I'm not here to convince you of this way :-) - TLama