@ECHO OFF

SETLOCAL ENABLEDELAYEDEXPANSION

SET BASEDIR=%~dp0
SET BASEDIR=%BASEDIR:~0,-1%

SET ARGS=
SET STRIPFIRST=0

FOR %%A IN (%*) DO (
   SET ARGS=!ARGS!,%%~A
   SET STRIPFIRST=1
)

IF "%STRIPFIRST%" == "1" (SET ARGS=%ARGS:~1%)

CD %BASEDIR%

gradlew.bat grain "-Pargs=%ARGS%"

ENDLOCAL

@ECHO OFF

SETLOCAL ENABLEDELAYEDEXPANSION

SET BASEDIR=%~dp0
SET BASEDIR=%BASEDIR:~0,-1%

SET ARGS=
SET STRIPFIRST=0

FOR %%A IN (%*) DO (
   SET ARGS=!ARGS!,%%~A
   SET STRIPFIRST=1
)

IF "%STRIPFIRST%" == "1" (SET ARGS=%ARGS:~1%)

CD %BASEDIR%

CALL gradlew.bat grain "-Pargs=%ARGS%"

ENDLOCAL

Add CALL when executing gradlew batch script
Add CALL when executing gradlew batch script
