I need to rename a file to zip, I try this code but doesn't works.
Exec('cmd.exe', 'rename '+ExpandConstant('{app}\scripts\set.bat'+' set.zip'), '', SW_SHOW,
ewWaitUntilTerminated, ResultCode);
I found a way to do it on [Run]
section, but I need it to do in [Code]
section.
You need to quote the paths, as {app}
typically contains spaces (Program Files
).
You need /C
command-line parameter before the command.
Exec('cmd.exe',
'/C rename ' + AddQuotes(ExpandConstant('{app}\scripts\set.bat')) + ' set.zip',
'', SW_SHOW, ewWaitUntilTerminated, ResultCode);
Though as @Alex correctly commented, use RenameFile
instead:
RenameFile(ExpandConstant('{app}\scripts\set.bat'), ExpandConstant('{app}\scripts\set.zip'));