I would like to import a reg file after installing. Here is my code:
procedure CurStepChanged(CurStep: TSetupStep);
Var
ResultCode: Integer;
begin
if CurStep = ssPostInstall then begin
Exec('{win}\regedit.exe', '{app}\MyReg.reg', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
end;
end;
I also tried this:
[Run]
Filename "{win}\regedit.exe"; Parameters: "{app}\MyReg.reg";
Both fail with:
Cannot import MyReg.reg: Error opening the file. There may be a disk or file system error.
I tried to import reg file manually (cmd.exe
)
C:\Windows\regedit.exe MyReg.reg
If you are installing to Program Files
, then the {app}
contains spaces.
You should always wrap paths to double quotes to allow paths with spaces.
Exec('{win}\regedit.exe', '"{app}\MyReg.reg"', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
Similarly:
[Run]
Filename "{win}\regedit.exe"; Parameters: """{app}\MyReg.reg""";