Skip to content

Commit

Permalink
Update VMwareWorkstation17Pro-test.bat
Browse files Browse the repository at this point in the history
  • Loading branch information
hieuck committed Nov 12, 2024
1 parent 7982853 commit ecd42db
Showing 1 changed file with 44 additions and 37 deletions.
81 changes: 44 additions & 37 deletions VMwareWorkstation17Pro-test.bat
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,23 @@ if "%choice%"=="1" (
echo You have chosen to download from: %Menu2%
if not "%LinkFromGithub%"=="" (
if not "%NumPartFromGithub%"=="" (
goto DownloadPartFromGithub
REM Check if there is a part in the link or not

for /l %%i in (1,1,%NumPartFromGithub%) do (
set "LinkPartFromGithub=%LinkFromGithub%/%FileName%.part%%i.rar"
set "FileNamePart=%FileName%.part%%i.rar"

REM Log the part URLs and file names
echo Downloading part %%i: !LinkPartFromGithub! > "%Temp%\hieuckitlog.txt"
echo Saving as: !FileNamePart! >> "%Temp%\hieuckitlog.txt"

REM Check if wget exists, otherwise use curl
if exist "wget.exe" (
wget --no-check-certificate --show-progress -q -O "!FileNamePart!" -U "%UserAgent%" "!LinkPartFromGithub!"
) else (
curl -L --max-redirs 20 -A "%UserAgent%" -o "!FileNamePart!" "!LinkPartFromGithub!" --insecure
)
)
)
set "LinkForOldWindows="
set "LinkForOldWindows32bit="
Expand Down Expand Up @@ -192,34 +208,6 @@ if "%choice%"=="1" (
)

endlocal

:DownloadPartFromGithub
REM Check if there is a part in the link or not

for /l %%i in (1,1,%NumPartFromGithub%) do (
set "LinkPartFromGithub=%LinkFromGithub%/%FileName%.part%%i.rar"
set "FileNamePart=%FileName%.part%%i.rar"

REM Log the part URLs and file names
echo Downloading part %%i: !LinkPartFromGithub! >> "%Temp%\hieuckitlog.txt"
echo Saving as: !FileNamePart! >> "%Temp%\hieuckitlog.txt"

REM Check if wget exists, otherwise use curl
if exist "wget.exe" (
wget --no-check-certificate --show-progress -q -O "!FileNamePart!" -U "%UserAgent%" "!LinkPartFromGithub!"
) else (
curl -L --max-redirs 20 -A "%UserAgent%" -o "!FileNamePart!" "!LinkPartFromGithub!" --insecure
)
)

REM Combine downloaded parts into a single file
copy /b %FileName%.part*.rar %FileName%

REM Clean up individual part files
del %FileName%.part*.rar

goto ExitDLwB

:NextStepAfterChosen

REM Convert to direct download Link.
Expand Down Expand Up @@ -620,13 +608,21 @@ echo.
@echo off
echo Downloading 7-Zip...
if /i "%Extract7z%"=="Yes" (
if exist "wget.exe" (
wget --no-check-certificate --show-progress -q -O "7z.dll" -U "%UserAgent%" "%Link7zdll%"
wget --no-check-certificate --show-progress -q -O "7z.exe" -U "%UserAgent%" "%Link7zexe%"
) else (
curl -L --max-redirs 20 -A "%UserAgent%" -o "7z.dll" "%Link7zdll%" --insecure
curl -L --max-redirs 20 -A "%UserAgent%" -o "7z.exe" "%Link7zexe%" --insecure
)
set "ConditionMet=1"
) else if not "%NumPartFromGithub%"=="" (
set "ConditionMet=1"
)

if defined ConditionMet (
if exist "wget.exe" (
wget --no-check-certificate --show-progress -q -O "7z.dll" -U "%UserAgent%" "%Link7zdll%"
wget --no-check-certificate --show-progress -q -O "7z.exe" -U "%UserAgent%" "%Link7zexe%"
) else (
curl -L --max-redirs 20 -A "%UserAgent%" -o "7z.dll" "%Link7zdll%" --insecure
curl -L --max-redirs 20 -A "%UserAgent%" -o "7z.exe" "%Link7zexe%" --insecure
)
) else (
echo Error: Both conditions failed.
)

REM Install
Expand All @@ -649,7 +645,18 @@ echo.
@echo off
echo Installing %SoftName%...
if not "%NumPartFromGithub%"=="" (
@7z.exe x -p123 "%FileName%" -o"%FileName%" -aoa -y
set "FirstPart=%FileName%.part1.rar"
if exist "!FirstPart!" (
echo Extracting !FirstPart!...
7z.exe x -p123 "!FirstPart!" -o"%FileName%" -aoa -y
if %errorlevel%==0 (
echo Extraction successful.
) else (
echo Extraction failed. Check the file or password.
)
) else (
echo File !FirstPart! not found.
)
)
if /i "%Extract7z%"=="Yes" (
@7z l "%FileName%" > nul 2>&1
Expand Down

0 comments on commit ecd42db

Please sign in to comment.