Script to automate nightly installer download (windows / linux)

Every morning I do:

  1. Go to by using web browser (chrome);
  2. Download latest “kicad-msvc.*-x86_64-lite.exe” to my PC for archive purpose;
  3. Run installer (update kidcad to latest nightly).

How can I automate steps 1 and 2 by some kind of script?

I have access to usual windows (cmd.exe) and linux command line tools (cURL, wGet).

If I do plain curl,
I get blank html source, without dynamically loaded contents which I need. Actual links to “kicad-msvc.*-x86_64-lite.exe” are loaded dynamically by javascript. Is it possible to handle dynamic webpages without having additional tools installed on my OS?

This will give you list of files,

curl '' | egrep -o 'kicad-msvc[a-zA-Z0-9._\-]*lite.exe'

To get a download url just add prefix with awk/sed.

1 Like

Thank you for very qui1ck answer! :slight_smile:
Here is the script in case someone is willing to reuse. It is running with msys2 installed on my windows.


FILE=$(curl --silent '' | egrep -o 'kicad-msvc[a-zA-Z0-9._\-]*x86_64-lite.exe' | tail -1)

# Check curl success
if [ -z "$FILE" ];	then 
		printf "curl fail, terminate\n";
		exit 1;

printf "Latest installer: $FILE \n"

if test -f "$FILE";
		printf "Error: \"$FILE\" is already downloaded, terminate";
		exit 1;

# download installer
curl$FILE --output $FILE

# check curl error
if test "$res" != "0";
		printf "Error: curl failed with: $res, terminate\n"
		exit 1;

start "" "$FILE" /B

Addition (run installer silently):
I could not run installer in silent mode (/S), so this workaround worked (last lines of the script):

# Not working in silent mode :/
# start "" "$FILE /S" /B
# So using this workaround:
cat > "last_installer_cmd.cmd" << EOF
ECHO Installing Kicad...
${FILE} /S

start "" "last_installer_cmd.cmd" /B

Why do you add linux in the mix here?

Whenever I feel like updating, I do a:

sudo apt update
sudo apt upgrade

and this handles both KiCad, KiCad-nightly and all other programs on my Linux box.

And the only reason I have to type those lines in a terminal is because I disabled the graphical GUI update thing that auto-starts somewhere in the boot process and partially does this in the background, and then nestles itself in the taskbar if it founds updates.

because I am on windows, but I feel that linux subsystem has more flexibility.

If for some reason you want a CLI method on Linux because you want to download at a quiet time, or like me in the bad old days when I had separate quotas for peak and off-peak hours, there is usually an option to the CLI package manager that says download but don’t install. Then later on in the day you will find the packages downloaded and will only take moments to install. You can also cronjob it, but you’ll have to do this as root, also because sudo requires a tty.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.