자체 추출 SFX 아카이브를 만듭니다
Aspose.zip을 사용하면 SFX (Self Extracting) 아카이브를 만들 수 있습니다. 이것은 프라이나 이름 확장자가있는 특별한 종류의 지퍼 파일입니다. 두 번 클릭하여 자체 추출 파일을 압축 할 수 있습니다.
생성 자체 추출 아카이브
자체 추출 아카이브 인스턴스 인스턴트 Selfextractoroptions을 구성하고 저축시 ArchivesAveOptions로 전달합니다.
1try (fileoutputStream ZipFile = 새 FileOutputStream ( "archive.exe")) {
2 try (Archive Archive = new Archive ()) {
3 archive.createentry ( "entry.bin", "data.bin");
4 ArchivesAveOptions 옵션 = 새 아카이브 aveOptions ();
5 Options.setSelfextractorOptions (new self -extractoroptions ());
6 Archive.save (zipfile, 옵션);
7 }
8} catch (ioException ex) {
9}
자체 추출 아카이브 실행
생산 된 아카이브는 실행 파일이며 .NET 프레임 워크 2.0 이상이 필요합니다. 이러한 프레임 워크에는 Windows Vista 이상이 제공됩니다.
두 번 클릭하여 일반 프로그램으로 실행하거나 명령 줄 인터페이스를 통해 실행할 수 있습니다.
추출을 시작하려면 자동으로-autoextract
명령 줄 옵션을 지정하십시오. 견본:
1C:\>archive.exe -autoExtract -password:T0p$ecret
자체 추출 아카이브를위한 명령 줄 옵션
Option | Meaning | Sample |
---|---|---|
-autoExtract | Primary option - without it decompression does not start. Extraction starts automatically, other options apply. | sfx.exe -autoExtract |
-autoClose | Window closes when the extraction is complete. This option only makes sense if -autoExtract option is present. | sfx.exe -autoExtract -autoClose |
-forceOverwrite | Overwrites all existing files without prompt if there are any. This option only makes sense if -autoExtract option present. | sfx.exe -autoExtract -forceOverwrite |
-password: | Provides a password to encrypted entries. This option only makes sense if -autoExtract option is present. If you have spaces within the password quote it. | sfx.exe -autoExtract -password:T0p$ecret |
-destination: | Extracts files to the supplied directory. This option only makes sense if -autoExtract option is present. If you have spaces within the path quote it. | sfx.exe -autoExtract -destination:"C:\My Documents" |
이 옵션을 사용하여 Windows에서 배치 스크립트를 작성할 수 있습니다.