Automating installs & downloads
Latest Git:
wget --no-check-certificate https://code.google.com/p/msysgit/downloads/list -O - 2>nul ^
| sed -n "0,/.*\(\/\/msysgit.googlecode.com\/files\/Git-.*\.exe\).*/s//http:\1/p" ^
| wget -i - -O Git-Latest.exe
or in one line:
wget --no-check-certificate https://code.google.com/p/msysgit/downloads/list -O - 2>nul | sed -n "0,/.*\(\/\/msysgit.googlecode.com\/files\/Git-.*\.exe\).*/s//http:\1/p" | wget -i - -O Git-latest.exe
Get latest GoW (GNU on Windows):
wget --no-check-certificate https://github.com/bmatzelle/gow/downloads -O - 2>nul ^
| sed -n "0,/.*\(\/downloads\/bmatzelle\/gow\/Gow-.*\.exe\)"".*/s//https:\/\/github\.com\1/p" ^
| wget --no-check-certificate -i - -O Gow-Latest.exe
And install silently:
start /wait Gow-Latest.exe /S /D="%ProgramFiles%\Tools" && echo Gnu On Windows (GOW) Installed
It adds itself to a path variable, and removes from path on uninstall.
x Download any GnuWin32 utility (you have to have wget), and install it
wget -nc http://gnuwin32.sourceforge.net/downlinks/sed.php
for /f "tokens=*" %f in ('dir sed-*-setup.exe /B') do @(start /wait %f /silent /dir="%ProgramFiles%\Tools" /noicons /components="bin" /tasks="" && echo Sed Installed)
http://gnuwin32.sourceforge.net/downlinks/wget.php
Note about escaping in sed
You simply must always, ALWAYS use \x22
instead of double quote in
SED! For the backslash \
, you must always use \x5c
. So in Sed in
Windows (both GnuWin and MSYS) you should use \x5c\x5c
, because two
backslashes \\
is not relieble - doesn’t have the same effect in both
variants.
Find out where Git is installed:
reg query HKEY_CURRENT_USER\Software\Git-Cheetah -v PathToMsys ^| sed -n "s/.*REG_SZ\s*\(.*\)/\1/p"
You can use pipe inside grouping in command line (see above example),
but then don’t forget to escape it with ^
How to convert from relative to absolute path, in command line:
pushd "%_GIT%"
set _GIT="%CD%"
popd