簡體   English   中英

WinRar SFX,解壓到動態文件夾

[英]WinRar SFX, extract to dynamic folder

我有一些程序的 RAR SFX。 根據某些條件(命令行參數是我可以做的),SFX 應該提取到 TEMP 文件夾或當前文件夾。

它基本上是該軟件的新版本。 如果從網上下載,解壓到temp文件夾,然后安裝搜索SW所在的地圖。 如果從程序內部下載,那么我知道相對於下載路徑的程序位置和解壓縮應該進入當前文件夾......

有什么辦法可以使用 RAR SFX 實現這一點?

TNX。

在您的程序中,您可以跳過文件的 SFX 標頭並將其作為常規 RAR 文件解壓縮到您想要的文件夾中。 它需要很少的代碼或嵌入 Winrar 或 7zip liraries。

此批處理代碼向您展示了我們如何創建受密碼和自定義圖標保護的SFXS el F -e X牽引),當然如果您想添加它們

@echo off
Set SFX_Name=TestSFX.exe
Set SfxOptions=SfxOptions.txt
Set AddFile=MyBatchFile.bat
Set Icon=HackooIcon.ico
Set Winrar="%ProgramFiles%\WinRAR\WinRar.exe"
Set ExtractedPath=%tmp%\hackoo
Set Setup=%ExtractedPath%\MyBatchFile.bat
Set Password=hackoo123

(
    echo ;The comment below contains SFX script commands
    echo Path="%ExtractedPath%"
    echo Silent=1
    echo OverWrite=1
    echo Setup="%Setup%"
)> "%SfxOptions%"

%Winrar% a -c -cfg- -ep1 -idq -m5 -mdg -r -s -sfx -y -iicon"%Icon%" -hp"%Password%" "-z%SfxOptions%" "%SFX_Name%" "%AddFile%"
if errorlevel 1 goto Failure
::del "%~dp0SfxOptions.txt"
goto :EOF

:Failure
::del "%~dp0SfxOptions.txt"
echo.
echo Error on creation of "%~dp0%SFX_Name%"
echo.
pause

對於其他開關和命令,您可以執行此批處理以打開 Winrar 的幫助文件:

@echo off
Set WinrarHelp=%ProgramFiles%\WinRAR\WinRAR.chm
Start "" "%WinrarHelp%"

rar命令行中的“ -c”開關是什么意思?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM