Innosetup 스크립트에 설치 관련 컴퓨팅 문자열을 어떻게 추가합니까?
-
11-12-2019 - |
문제
현재 프로그램을 업그레이드 할 때 i 기존 파일을 프로그램 디렉토리의 백업이라는 폴더로 백업하십시오.
Source: "{app}\filename.exe"; DestDir: "{app}\backup"; Flags: external skipifsourcedoesntexist uninsneveruninstall
.
코드가 와 같은 것과 같은 문자열을 지정하거나 계산하는 방법이 있습니다.
Source: "{app}\filename.exe"; DestDir: "{app}\backup{date}"; Flags: external skipifsourcedoesntexist uninsneveruninstall
.
또는 이전 버전의 정보와 함께 날짜를 결합
Source: "{app}\filename.exe"; DestDir: "{app}\backup{previous version}{date}"; Flags: external skipifsourcedoesntexist uninsneveruninstall
. 해결책
Please read Pascal Scripting: Scripted Constants and Pascal Scripting: Support Functions Reference. Also read this and this. Anyway, this is how I did it:
[Dirs]
; create an empty folder...
Name: "{app}\{code:MyDateTimeString}"
[Code]
function MyDateTimeString(Param: String): String;
begin
Result := GetDateTimeString('yyyy.mm.dd_hh.nn.ss', #0, #0);
end;
다른 팁
You can add runtime dynamic values using {code:...}
constants.
An example of getting the current date and making a backup of the installation folder can be seen on the ISXKB wiki
제휴하지 않습니다 StackOverflow