Last active
June 4, 2019 15:37
-
-
Save 174n/cc94d2edeab21ecb5d0b78fec4aa67e7 to your computer and use it in GitHub Desktop.
download aria2c bat file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
if not exist "%~dp0aria2c.exe" ( | |
echo Downloading aria2c.exe... | |
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://uupdump.ml/autodl_files/aria2c.exe', '%~dp0aria2c.exe')" | |
) | |
call :checkhash "3eb8712b0db6ba466f8afe1bf606983fe8341c941bdfcadc07068288c7ca5a9c" "aria2c.exe" | |
goto start | |
:checkhash | |
for /F "skip=1" %%i in ('certutil -hashfile %~2 SHA256') do set CURRHASH=%%i & goto HaveValue | |
:HaveValue | |
set CURRHASH=%CURRHASH: =% | |
if not "%~1" == "%CURRHASH%" ( | |
del %~2 | |
echo "%~2 hash does not match" | |
goto halt | |
) | |
goto :EOF | |
:halt | |
call :haltHelper 2> nul | |
:haltHelper | |
() | |
exit /b | |
:start | |
echo "hi there" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://stackoverflow.com/questions/10534911/how-can-i-exit-a-batch-file-from-within-a-function