Skip to content

Instantly share code, notes, and snippets.

@gerarldlee
Created February 5, 2015 13:08
Show Gist options
  • Save gerarldlee/85025e0aa4e282cc50b3 to your computer and use it in GitHub Desktop.
Save gerarldlee/85025e0aa4e282cc50b3 to your computer and use it in GitHub Desktop.
Provide a way to run Cygwin commands from Windows terminal or command prompt
@echo off
setlocal enableextensions enabledelayedexpansion
set SCRIPT_PATH=%~dp0
set SCRIPT_PATH=%SCRIPT_PATH:\=/%
set BABUN_HOME=%SCRIPT_PATH%
:BEGIN
set CYGWIN_HOME=%BABUN_HOME%\cygwin
if exist "%CYGWIN_HOME%\bin\bash.exe" goto RUN
if not exist "%CYGWIN_HOME%\bin\bash.exe" goto NOTFOUND
:RUN
ECHO [babun] Starting ansible-playbook
"%CYGWIN_HOME%\bin\bash.exe" -c "/bin/ansible-playbook %*" || goto :ERROR
GOTO END
:NOTFOUND
ECHO [babun] Start script not found. Did you delete the the .babun folder from the USER_HOME?
EXIT /b 255
:ERROR
ECHO [babun] Terminating due to internal error #%errorlevel%
EXIT /b %errorlevel%
:END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment