View Full Version : How make Copy Function in InnoSetup
ZAZA4EVER
04-10-2019, 17:29
i want to copy file to another folder after install repack
how i can do it in inno script
i use this script
https://fileforums.com/showthread.php?t=102463
Example
I want To Make CopyFile "Resume_1_A4.docx" And Rename it to "Resume_1_Letter.docx"
After Install Repack
bunti_o4u
04-10-2019, 21:59
i want to copy file to another folder after install repack
how i can do it in inno script
i use this script
https://fileforums.com/showthread.php?t=102463
Example
I want To Make CopyFile "Resume_1_A4.docx" And Rename it to "Resume_1_Letter.docx"
After Install Repack
Make a batch file for required function and run it post installation...
Afair ,innosetup have a builtin copy command.
I used it once before.
Or im getting old ?!
http://www.jrsoftware.org/ishelp/index.php?topic=isxfunc_filecopy
ZAZA4EVER
05-10-2019, 03:35
http://www.jrsoftware.org/ishelp/index.php?topic=isxfunc_filecopy
function FileCopy(const '{app}\openingmovie.bk2', '{app}\openingmovie_hi.bk2': String; const FailIfExists: Boolean): Boolean;
How i use it ,, in isdone script or original script i a can not appy it
ZAZA4EVER
05-10-2019, 03:36
Make a batch file for required function and run it post installation...
i use this bat
@echo off
COPY /-y "{app}\openingmovie.bk2" "{app}\openingmovie_hi.bk2"
but {app} dont work with installation
can you tell me how do it ?
function FileCopy(const '{app}\openingmovie.bk2', '{app}\openingmovie_hi.bk2': String; const FailIfExists: Boolean): Boolean;
How i use it ,, in isdone script or original script i a can not appy it
FileCopy(ExpandConstant('{app}\openingmovie.bk2'), ExpandConstant('{app}\openingmovie_hi.bk2'), False);
Boolean is always 'True' or 'False'.
You can also use something like this
[ Code]
var
ResultCode: Integer;
ShellExec('open', 'cmd.exe', '/c copy /Y "' + ExpandConstant('{app}\openingmovie.bk2') + '" "' + ExpandConstant('{app}\openingmovie_hi.bk2') + '"', '', SW_Hide, ewWaitUntilTerminated, ResultCode);
In this example inno setup use cmd.exe from windows os and use it to copy a file with parameters /c /y
You have to use one of the the above codes somewhere after install procedure (at the time when the game is installed, like on finish page).
ZAZA4EVER
05-10-2019, 05:50
FileCopy(ExpandConstant('{app}\openingmovie.bk2'), ExpandConstant('{app}\openingmovie_hi.bk2'), False);
Boolean is always 'True' or 'False'.
You can also use something like this
[ Code]
var
ResultCode: Integer;
ShellExec('open', 'cmd.exe', '/c copy /Y "' + ExpandConstant('{app}\openingmovie.bk2') + '" "' + ExpandConstant('{app}\openingmovie_hi.bk2') + '"', '', SW_Hide, ewWaitUntilTerminated, ResultCode);
In this example inno setup use cmd.exe from windows os and use it to copy a file with parameters /c /y
You have to use one of the the above codes somewhere after install procedure (at the time when the game is installed, like on finish page).
can you tell me ,, where i can add this lines in script
cause i use first as
[Run]
Filename: FileCopy(ExpandConstant('{app}\openingmovie.bk2'), ExpandConstant('{app}\openingmovie_hi.bk2'), False);
and dont work ,,, thanks for your replay and help
Both of the codes you have to use in [Code] section.
ZAZA4EVER
05-10-2019, 16:10
Both of the codes you have to use in [Code] section.
can you write code for me in script and upload it.. cause i try and fail
Razor12911
05-10-2019, 18:41
[Code]
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssDone then
FileCopy(ExpandConstant('{app}\openingmovie.bk2'), ExpandConstant('{app}\openingmovie_hi.bk2'), False);
end;
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.