FileInstall

지정된 파일을 스크립트의 컴파일 버전에 포함시킵니다.

FileInstall, Source, Dest , Overwrite

매개변수

Source

컴파일된 EXE에 추가할 파일의 이름. 절대 경로를 지정하지 않으면 파일이 스크립트 자신의 디렉토리에 (또는 상대적으로) 있다고 간주됩니다.

파일 이름에는 겹따옴표, 변수 참조 (예, %A_ProgramFiles%) 또는 와일드카드가 포함되면 안 됩니다. 게다가, (모든 다른 명령어의 매개변수와 똑 같이) 글자 그대로의 퍼센트와 쉼표 같은 특수 문자들은 피신 시켜야 합니다. 마지막으로, 이 매개변수는 FileInstall 명령어의 오른쪽에 나열해야 합니다 (즉, 그 아래의 계속 섹션에 나열하면 안 됩니다).

Dest

Source를 EXE로부터 추출할 때, 이것이 생성될 파일의 이름입니다. 절대 경로를 지정하지 않으면 %A_WorkingDir%에 있다고 간주됩니다. 목표 디렉토리는 이미 존재해야 합니다. Source와 다르게, 변수 참조를 사용해도 됩니다.

Overwrite

This parameter determines whether to overwrite files if they already exist. If this parameter is 1 (true), the command overwrites existing files. If omitted or 0 (false), the command does not overwrite existing files.

이 매개변수는 표현식일 수 있습니다. 심지어 거짓이나 참으로 평가되면 무엇이든 될 수 있습니다 (참과 거짓은 내부적으로 1과 0으로 저장되기 때문입니다).

에러 처리

[v1.1.04+]: 이 명령어는 실패하면 예외를 던질 수 있습니다. 더 자세한 정보는 실행시간 에러를 참조하십시오.

ErrorLevel is set to 1 on failure or 0 on success.

Any case where the file cannot be written to the destination is considered failure. 예를 들어:

논평

When this command is read by Ahk2Exe during compilation of the script, the file specified by Source is added to the resulting compiled script. Later, when the compiled script EXE runs and the call to FileInstall is executed, the file is extracted from the EXE and written to the location specified by Dest.

Files added to a script are neither compressed nor encrypted during compilation, but the compiled script EXE can be compressed by using the appropriate option in Ahk2Exe.

이 명령어를 정상의 (컴파일 안 된) 스크립트에 사용하면, 대신에 간단한 파일 복사가 수행됩니다 -- 그래서 스크립트가 결국 제대로 컴파일될지 테스트하는 데 도움이 됩니다.

FileCopy, #Include

예제

Includes a text file inside the compiled version of the script. Later, when the compiled script is executed, the included file is extracted to another location with another name. If a file with this name already exists at this location, it will be overwritten.

FileInstall, My File.txt, %A_Desktop%\Example File.txt, 1