Upgrading and installing packages through the Cygwin command-line?

Install apt-cyg:

lynx -source https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg
install apt-cyg /bin

After that you'll be able to install say the package "lynx" including dependencies by running:

apt-cyg install lynx

Since some people correctly stated that apt-cyg itself needs wget and in order to get apt-cyg you need wget, there is a bash only solution to bootstrap wget in pure bash.

Create a function like this in your mintty bash shell:

function __wget() {
    : ${DEBUG:=0}
    local URL=$1
    local tag="Connection: close"
    local mark=0

    if [ -z "${URL}" ]; then
        printf "Usage: %s \"URL\" [e.g.: %s http://www.google.com/]" \
               "${FUNCNAME[0]}" "${FUNCNAME[0]}"
        return 1;
    fi
    read proto server path <<<$(echo ${URL//// })
    DOC=/${path// //}
    HOST=${server//:*}
    PORT=${server//*:}
    [[ x"${HOST}" == x"${PORT}" ]] && PORT=80
    [[ $DEBUG -eq 1 ]] && echo "HOST=$HOST"
    [[ $DEBUG -eq 1 ]] && echo "PORT=$PORT"
    [[ $DEBUG -eq 1 ]] && echo "DOC =$DOC"

    exec 3<>/dev/tcp/${HOST}/$PORT
    echo -en "GET ${DOC} HTTP/1.1\r\nHost: ${HOST}\r\n${tag}\r\n\r\n" >&3
    while read line; do
        [[ $mark -eq 1 ]] && echo $line
        if [[ "${line}" =~ "${tag}" ]]; then
            mark=1
        fi
    done <&3
    exec 3>&-
}

Now you can use it almost like wget:

__wget http://apt-cyg.googlecode.com/svn/trunk/apt-cyg > /usr/bin/apt-cyg && chmod 0755 /usr/bin/apt-cyg

Old question, but for others that google and got here: Official setup has command line arguments which allowed me to prepare simple *.bat script - just put following line in e.g. "install-pkg.bat" and put that file into your root directory (e.g. C:\cygwin):

setup-x86.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --root "%cd%" --packages %*

You need to download and put http://www.cygwin.com/setup-x86.exe (32bit) or http://www.cygwin.com/setup-x86_64.exe (64bit) into the same directory. Now all you have to do to install package is:

install-pkg packagename

Positive: official setup, should always work, for any package. Negative: current (june/2015) official setup requires administrator rights even though it actually does not need one (e.g. root directory outside system folders).