In order to call the Windows batch scripts on the command line
from a different folder, the path to the files in the Gitblit
directory needs to be explicitly stated in the Java command.
Otherwise the JAR files or data directory are not found as they
would be searched in the current directory.
-@java -cp gitblit.jar;"%CD%\ext\*" com.gitblit.GitBlitServer --stop --baseFolder data %*\r
+@java -cp "%~dp0gitblit.jar";"%~dp0ext\*" com.gitblit.GitBlitServer --stop %*\r
-@java -cp gitblit.jar;"%CD%\ext\*" com.gitblit.GitBlitServer --baseFolder data %*\r
+@SETLOCAL\r
+\r
+@SET gbhome=%~dp0\r
+@SET gbhome=%gbhome:~0,-1%\r
+\r
+@java -cp "%gbhome%\gitblit.jar";"%gbhome%\ext\*" com.gitblit.GitBlitServer --baseFolder "%gbhome%\data" %*\r
+\r
+@ENDLOCAL\r