setlocal enabledelayedexpansion

for %%g in (grass78) do (
	for /f "usebackq tokens=1" %%a in (`%%g --config version`) do set gv=%%a
	for /F "delims=." %%i in ("!gv!") do set v=%%i

	del "%OSGEO4W_STARTMENU%\QGIS Desktop 3.19.0 with GRASS !gv! (Nightly).lnk"
	del "%OSGEO4W_STARTMENU%\QGIS Browser 3.19.0 with GRASS !gv! (Nightly).lnk"
	del "%OSGEO4W_DESKTOP%\QGIS Desktop 3.19.0 with GRASS !gv! (Nightly).lnk"
	del "%OSGEO4W_DESKTOP%\QGIS Browser 3.19.0 with GRASS !gv! (Nightly).lnk"
	del "%OSGEO4W_ROOT%\bin\qgis-dev-g!v!.bat"
	del "%OSGEO4W_ROOT%\bin\qgis-dev-bin-g!v!.exe"
	del "%OSGEO4W_ROOT%\bin\qgis-dev-bin-g!v!.env"
	del "%OSGEO4W_ROOT%\bin\qgis-dev-bin-g!v!.vars"
)

del "%OSGEO4W_STARTMENU%\Qt Designer with QGIS 3.19.0 custom widgets (Nightly).lnk"
rmdir "%OSGEO4W_STARTMENU%"
del "%OSGEO4W_DESKTOP%\Qt Designer with QGIS 3.19.0 custom widgets (Nightly).lnk"
rmdir "%OSGEO4W_DESKTOP%"

del "%OSGEO4W_ROOT%\bin\qgis-dev-bin.env"
del "%OSGEO4W_ROOT%\bin\qgis-dev-designer.bat"
del "%OSGEO4W_ROOT%\bin\python-qgis-dev.bat"
del "%OSGEO4W_ROOT%\bin\qgis_process-qgis-dev.bat"
del "%OSGEO4W_ROOT%\apps\qgis-dev\python\qgis\qgisconfig.py"
del "%OSGEO4W_ROOT%\apps\qgis-dev\bin\qgis.reg"
del /s /q "%OSGEO4W_ROOT%\apps\qgis-dev\*.pyc"

endlocal
