Install [Cygwin](https://www.cygwin.com/) and cygwin's package manager, [apt-cyg](https://github.com/transcode-open/apt-cyg).
On Cygwin Terminal, install compiler and tools :
apt-cyg install cygwin32-gcc-core cygwin32-gcc-g++ gcc-core gcc-g++ make wget patch diffutils grep tar gzip
Now you have a compiler, but no libraries. You need readline, openssl, libconfig, liblua, python and libjansson to use telegram-cli's full functionality.
We need to patch Makefile and loop.c to compile in cygwin. Download this [diff](https://gist.github.com/ied206/d774a445f36004d263ab) then untar. Then, patch in 'tg' directory.
cd tg
patch -p1 < telegram-cli-cygwin.diff
Then
make
There will be some warnings, but you can ignore them. After compile is done, **telegram-cli.exe** will be generated in **bin** directory.
To run telegram-cli, type
bin/telegram-cli -k tg-server.pub
**Caution**: Binary compiled with Cygwin should be run in Cygwin Terminal, since it assumes unix-like shell, and it is dependent on cygwin dlls.