Skip to content

Commit

Permalink
tối ưu code
Browse files Browse the repository at this point in the history
  • Loading branch information
hieuck committed Jun 24, 2024
1 parent 1b8dfbb commit 2fc30c1
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 9 deletions.
36 changes: 27 additions & 9 deletions TreeSizeProfessional9.bat
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
:: Github: https://github.com/hieuck/curl-uri-wget-download-setup ::
:: Facebook: https://www.facebook.com/ZzhieuhuhongzZ/ ::
:: Donate to me: Vietcombank - 9966595263 - LE TRUNG HIEU ::
:: MoMo - 0966595263 - LE TRUNG HIEU ::
:: ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@ECHO OFF
Expand Down Expand Up @@ -71,7 +72,7 @@ set "Link=https://downloads.jam-software.de/treesize/TreeSize-Setup.exe"
set "LinkForAllWindows32bit="
set "LinkForAllWindows64bit="

set "LinkFromGithub=TreeSize/TreeSize-!SoftNameVersion!-Setup.exe"
set "LinkFromGithub=TreeSize-!SoftNameVersion!-Setup.exe"
set "LinkFromDropbox="
set "LinkFromOneDrive="

Expand All @@ -82,7 +83,7 @@ set "SoftPathFor64bit="
REM set "TS_INSTALL_PASSWORD=4LGX7A-5TR7AX-JDZ2VK-UU5DHV-ZXSULR-4A3AMJ-5VEFLX" /PASSWORD=%TS_INSTALL_PASSWORD%
set "QuietMode=/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-"

set "Cr4ckFile=TreeSizeCr4ck/TreeSizeProfessional-!SoftNameVersion!-Cr4ck"
set "Cr4ckFile=TreeSize-!SoftNameVersion!-Cr4ck"
set "Cr4ckPath="

set "Shortcut="
Expand All @@ -91,36 +92,53 @@ set "NoticeOption="
REM MenuChoice Configuration
setlocal EnableDelayedExpansion

:: Extracting the necessary parts from LinkFromGithub
for /f "tokens=1,2 delims=-." %%a in ("%LinkFromGithub%") do (
set "prefixLFG=%%a"
set "versionLFG=%%b"
)

:menu
set "Menu1=Official Website"
set "Menu2=My Github"
set "Menu3=My Dropbox"
set "Menu4=My OneDrive"

REM Use the pattern "2. %Menu2% & echo." !MenuOptions!3. %Menu3%" to break the line.
set "MenuOptions="
if not "!LinkFromGithub!"=="" (
set "MenuOptions=!MenuOptions!2. %Menu2% "
set "MenuOptions=!MenuOptions! 2. %Menu2%"
)
if not "!LinkFromDropbox!"=="" (
set "MenuOptions=!MenuOptions!3. %Menu3% "
set "MenuOptions=!MenuOptions! 3. %Menu3%"
)
if not "!LinkFromOneDrive!"=="" (
set "MenuOptions=!MenuOptions!4. %Menu4%"
set "MenuOptions=!MenuOptions! 4. %Menu4%"
)

if not "!MenuOptions!"=="" (
echo Do you want to use the download link from:
echo.
echo 1. %Menu1% %MenuOptions%

echo 1. %Menu1%%MenuOptions%
) else (
echo You have chosen to download from: %Menu1%
goto NextStepAfterChosen
)

REM The number corresponding to the default choice
set "defaultChoice=1"
echo Select an option (1 or 2 or 3 or 4) [Default is %defaultChoice%]:

set "OptionsChoice="
if not "!LinkFromGithub!"=="" (
set "OptionsChoice=!OptionsChoice! or 2"
)
if not "!LinkFromDropbox!"=="" (
set "OptionsChoice=!OptionsChoice! or 3"
)
if not "!LinkFromOneDrive!"=="" (
set "OptionsChoice=!OptionsChoice! or 4"
)
echo Select an option (1%OptionsChoice%) [Default is %defaultChoice%]:
choice /c 1234 /t 5 /d %defaultChoice% /n >nul

REM Check the errorlevel to determine the choice made by the user
Expand All @@ -147,7 +165,7 @@ if "%choice%"=="1" (
set "LinkForOldWindows32bit="
set "LinkForOldWindows64bit="

set "Link=https://github.com/hieuck/curl-uri-wget-download-setup/raw/main/Setup/%LinkFromGithub%"
set "Link=https://github.com/hieuck/curl-uri-wget-download-setup/raw/main/Setup/%prefixLFG%/%LinkFromGithub%"
set "LinkForAllWindows32bit="
set "LinkForAllWindows64bit="
goto NextStepAfterChosen
Expand Down

0 comments on commit 2fc30c1

Please sign in to comment.