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.16.7 with GRASS !gv! (Nightly).lnk"
	del "%OSGEO4W_STARTMENU%\QGIS Browser 3.16.7 with GRASS !gv! (Nightly).lnk"
	del "%OSGEO4W_DESKTOP%\QGIS Desktop 3.16.7 with GRASS !gv! (Nightly).lnk"
	del "%OSGEO4W_DESKTOP%\QGIS Browser 3.16.7 with GRASS !gv! (Nightly).lnk"
	del "%OSGEO4W_ROOT%\bin\qgis-ltr-dev-g!v!.bat"
	del "%OSGEO4W_ROOT%\bin\qgis-ltr-dev-bin-g!v!.exe"
	del "%OSGEO4W_ROOT%\bin\qgis-ltr-dev-bin-g!v!.env"
	del "%OSGEO4W_ROOT%\bin\qgis-ltr-dev-bin-g!v!.vars"
)

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

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

endlocal
