@echo off

goto :main


:main

echo Checking admin rights

C:\WINDOWS\system32\net.exe session>nul 2>&1

if %errorlevel%==0 (
echo You are admin


) else (
echo Sorry

goto :eof
)
goto :stoppingservice

:stoppingservice

echo Stopping Service


set installed_file_folder=
set service=service
set config=config
set braket=\
set "delbraket=\*"
set servicepath=%installed_file_folder%%service%%braket%
set mappingFile=portServiceMapping.txt
set exe=.exe
set "stop= stop"
set "installstop= uninstall"
set finalpath=%servicepath%%mappingFile% 
echo %finalpath%

set uninstall=uninstall
@echo reading text file

for /F "usebackq tokens=1,2 delims==" %%a in ("%finalpath%") do (
    echo "%servicepath%%%b%exe%"%stop%
	"%servicepath%%%b%exe%"%stop%
	C:\windows\system32\timeout /t 2 /NOBREAK
	echo "%servicepath%%%b%exe%"%installstop%

	"%servicepath%%%b%exe%"%installstop%


 )
echo Services uninstall successfully......

goto :serviceFolderDelete


:serviceFolderDelete
@echo Deleting Service Folder
rmdir /s /q "%installed_file_folder%%service%"
@echo Deleting Service Folder Successfully...
Del uninstall.bat
goto :eof

