@echo off
rem startgimp.cmd
rem (original by Shaneyfelt on bugzilla; modified by Rob Davenport)
rem
rem Description:
rem Launch The Gimp such that no console window appears.
rem We do this primarily by the /B parameter of the start command.
rem The rest of this garbarge is just so it works as expected
rem in most cases.
rem
rem If you set the default value of 
rem HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\gimp-2.0.exe
rem to this command script, then gimp-win-remote will use it to launch
rem the Gimp without a console window. 
rem However the console window to run this script will still flash by.
rem You will need the modified version of gimp-win-remote to quell this.

rem Save old path in case this is used on command-line directly.
rem (or could use setlocal/endlocal commands if extensions enabled)
set OPATH=%PATH%

rem Set the path for the Gimp process
set GIMPPATH=d:\Progra~1\GIMP-2.0\bin
path %GIMPPATH%;%PATH%

rem Start the Gimp
echo %GIMPPATH%\gimp-2.0.exe %~s1 %~s2 %~s3 %~s4 %~s5 %~s6 %~s7 %~s8 %~s9 

start "The GIMP" /B /D"%HOMEPATH%" "%GIMPPATH%\gimp-2.0.exe" %~s1 %~s2 %~s3 %~s4 %~s5 %~s6 %~s7 %~s8 %~s9 > Nul 2>&1 

rem "The GIMP" - window title
rem /B (no new console)
rem /D (default directory)
rem %~s1 = expands parameter n to a fully qualified filename using
rem          only short-fil-names (otherwise we must enclose them in 
rem          quotes and the Gimp tries to open "").  Can't just use %*
rem          construct as that won't expand paths.
rem (greater-than-sign) Nul - send stdout message to Nul device
rem 2(greater-than-sign)&1  - send stderr messages to where stdout is going

rem Restore path
path %OPATH%
