@echo off rem Run as shell scripts batch files starting with the magic incantation rem @#!sh %0.bat %* rem (C) Copyright 2006, 2010 Diomidis Spinellis - http://www.spinellis.gr rem Permission to use, copy, and distribute this software and its rem documentation for any purpose and without fee is hereby granted, rem provided that the above copyright notice appear in all copies and that rem both that copyright notice and this permission notice appear in rem supporting documentation. rem THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED rem WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF rem MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. rem Settings needed for the following to work setlocal EnableExtensions EnableDelayedExpansion rem Convert path to Unix style rem The following is the Unix equivalent of cmdpath=`cygpath ...` for /f "tokens=*" %%i in ('cygpath -u %~$PATH:1') do ( set cmdpath=%%i ) rem Obtain all arguments but %0 shift set args= :args_loop set args=!args! %1 shift if "%1" neq "" goto args_loop rem Invoke the shell with the Unix path of the command sh %cmdpath% !args! endlocal