I recommend you to look into cross-platform tool named PlatformIO. It has support for Windows OS and doesn't require Arduino IDE or any tools.
From Get Started let's install platform and setup environment for your Arduino Leonardo:
Install new development platform
> platformio platforms install atmelavr
Initialize new PlatformIO based project
> cd path\to\empty\directory
> platformio init
# Project has been initialized!
# Please put your source code to `src` directory, external libraries to `lib`
# and setup environments in `platformio.ini` file.
# Then process project with `platformio run` command.
Setup environments in the Project Configuration File platformio.ini
[env:my_leonardo_board]
platform = atmelavr
framework = arduino
board = leonardo
Process the project’s environments
> platformio run --target upload
P.S: What is interesting, this tool allows you to manage libraries via CLI and then you can build Arduino-based source code with single line
#include <%HEADER_FILE_OF_INSTALLED_LIB>