Aria2C Batch File For Quick Download

Copy to following CMD batch-file content into a new file,
and name it aria2download.cmd.

Place the file in the same folder as your aria2c.exe,
make sure it is your system-PATH,

and you can now enter aria2download "http..your-url..."
for a quick file-download to the current folder you are in.

All the important-switches are already set, such as maximum split value, and maximum connections per-server for ultra-fast download and an extra permissive-SSL to allow you to download from secure-servers without certificate verifying and a browser-like useragent and referrer value to generate a compatible download session with servers that often will block download-managers. You can easily personalise the batch-file to include an additional headers, authentications, etc…

@echo off

set URL="%~1"

::                               working environment state - FOLDER_WORKING can be another folder if the cmd is ran through another folder.
set FOLDER_WORKING=%CD%
set FOLDER_BATCH=%~dp0
set ARIA=%FOLDER_BATCH%aria2c.exe

::                                          normalise path
for /f %%a in ("%FOLDER_WORKING%")do ( set "FOLDER_WORKING=%%~fsa"  )
for /f %%a in ("%FOLDER_BATCH%")do (   set "FOLDER_BATCH=%%~fsa"    )
for /f %%a in ("%ARIA%")do (           set "ARIA=%%~fsa"            )

set ARGS=
::                               probably ok
set ARGS=%ARGS% --dir="%FOLDER_WORKING%"
set ARGS=%ARGS% --file-allocation="prealloc"
set ARGS=%ARGS% --human-readable="true"
set ARGS=%ARGS% --enable-color="true"

::                               probably ok
set ARGS=%ARGS% --split="16"
set ARGS=%ARGS% --min-split-size="1M"
set ARGS=%ARGS% --user-agent="Mozilla/5.0 AppleWebKit/537 Chrome/62 Safari/537.3"
set ARGS=%ARGS% --referer=%URL%
set ARGS=%ARGS% --http-no-cache="true"
set ARGS=%ARGS% --header="DNT: 1"

::                               error handling
set ARGS=%ARGS% --retry-wait="2"
set ARGS=%ARGS% --max-tries="3"
set ARGS=%ARGS% --timeout="120"

::                               overwrite
set ARGS=%ARGS% --continue="true"
set ARGS=%ARGS% --allow-overwrite="true"
set ARGS=%ARGS% --auto-file-renaming="false"

::                               log
set ARGS=%ARGS% --console-log-level="notice"

::                               certificate/ssl
set ARGS=%ARGS% --check-certificate="false"
set ARGS=%ARGS% --check-integrity="false"
::set ARGS=%ARGS% --http-auth-challenge="true"
::set ARGS=%ARGS% --rpc-allow-origin-all="true"
::set ARGS=%ARGS% --rpc-secure="false"

::                               ip/connection
set ARGS=%ARGS% --enable-http-keep-alive="true"
set ARGS=%ARGS% --enable-http-pipelining="true"
set ARGS=%ARGS% --disable-ipv6="true"
set ARGS=%ARGS% --connect-timeout="120"
set ARGS=%ARGS% --max-concurrent-downloads="128"
set ARGS=%ARGS% --max-connection-per-server="16"

@echo on
call %ARIA% %ARGS%   %URL%

@echo off
pause

This is extremely useful since it saves you typing all those common command-line switches and to-place the actual download-batch-script in a single folder as aria2c’s binary, instead of having few download scripts everywhere…

Also available in this gist:
gist.github.com/eladkarako/39c55bf0efffbf345bd587d74dada6b1