@echo off
cd  "%CD%"
for /f "tokens=4,5 delims=. " %%a in ('ver') do if %%a%%b geq 60 goto new

:old
cmd /c netsh firewall delete allowedprogram program="%CD%\RayLinkService.exe" profile=ALL
cmd /c netsh firewall add allowedprogram program="%CD%\RayLinkService.exe" name="RayLinkService" ENABLE
cmd /c netsh firewall add allowedprogram program="%CD%\RayLinkService.exe" name="RayLinkService" ENABLE profile=ALL

cmd /c netsh firewall delete allowedprogram program="%CD%\RayLink.exe" profile=ALL
cmd /c netsh firewall add allowedprogram program="%CD%\RayLink.exe" name="RayLink" ENABLE
cmd /c netsh firewall add allowedprogram program="%CD%\RayLink.exe" name="RayLink" ENABLE profile=ALL

cmd /c netsh firewall delete allowedprogram program="%CD%\RayLinkCapturer.exe" profile=ALL
cmd /c netsh firewall add allowedprogram program="%CD%\RayLinkCapturer.exe" name="RayLinkCapturer" ENABLE
cmd /c netsh firewall add allowedprogram program="%CD%\RayLinkCapturer.exe" name="RayLinkCapturer" ENABLE profile=ALL

cmd /c netsh firewall delete allowedprogram program="%CD%\RayLinkWatch.exe" profile=ALL
cmd /c netsh firewall add allowedprogram program="%CD%\RayLinkWatch.exe" name="RayLinkWatch" ENABLE
cmd /c netsh firewall add allowedprogram program="%CD%\RayLinkWatch.exe" name="RayLinkWatch" ENABLE profile=ALL
goto end
:new
cmd /c netsh advfirewall firewall delete rule name="RayLinkService"
cmd /c netsh advfirewall firewall add rule name="RayLinkService" dir=in action=allow program="%CD%\RayLinkService.exe" protocol=tcp enable=yes profile=public
cmd /c netsh advfirewall firewall add rule name="RayLinkService" dir=in action=allow program="%CD%\RayLinkService.exe" protocol=udp enable=yes profile=public
cmd /c netsh advfirewall firewall add rule name="RayLinkService" dir=in action=allow program="%CD%\RayLinkService.exe" protocol=tcp enable=yes profile=domain
cmd /c netsh advfirewall firewall add rule name="RayLinkService" dir=in action=allow program="%CD%\RayLinkService.exe" protocol=udp enable=yes profile=domain
cmd /c netsh advfirewall firewall add rule name="RayLinkService" dir=in action=allow program="%CD%\RayLinkService.exe" protocol=tcp enable=yes profile=private
cmd /c netsh advfirewall firewall add rule name="RayLinkService" dir=in action=allow program="%CD%\RayLinkService.exe" protocol=udp enable=yes profile=private

cmd /c netsh advfirewall firewall delete rule name="RayLink"
cmd /c netsh advfirewall firewall add rule name="RayLink" dir=in action=allow program="%CD%\RayLink.exe" protocol=tcp enable=yes profile=public
cmd /c netsh advfirewall firewall add rule name="RayLink" dir=in action=allow program="%CD%\RayLink.exe" protocol=udp enable=yes profile=public
cmd /c netsh advfirewall firewall add rule name="RayLink" dir=in action=allow program="%CD%\RayLink.exe" protocol=tcp enable=yes profile=domain
cmd /c netsh advfirewall firewall add rule name="RayLink" dir=in action=allow program="%CD%\RayLink.exe" protocol=udp enable=yes profile=domain
cmd /c netsh advfirewall firewall add rule name="RayLink" dir=in action=allow program="%CD%\RayLink.exe" protocol=tcp enable=yes profile=private
cmd /c netsh advfirewall firewall add rule name="RayLink" dir=in action=allow program="%CD%\RayLink.exe" protocol=udp enable=yes profile=private

cmd /c netsh advfirewall firewall delete rule name="RayLinkCapturer"
cmd /c netsh advfirewall firewall add rule name="RayLinkCapturer" dir=in action=allow program="%CD%\RayLinkCapturer.exe" protocol=tcp enable=yes profile=public
cmd /c netsh advfirewall firewall add rule name="RayLinkCapturer" dir=in action=allow program="%CD%\RayLinkCapturer.exe" protocol=udp enable=yes profile=public
cmd /c netsh advfirewall firewall add rule name="RayLinkCapturer" dir=in action=allow program="%CD%\RayLinkCapturer.exe" protocol=tcp enable=yes profile=domain
cmd /c netsh advfirewall firewall add rule name="RayLinkCapturer" dir=in action=allow program="%CD%\RayLinkCapturer.exe" protocol=udp enable=yes profile=domain
cmd /c netsh advfirewall firewall add rule name="RayLinkCapturer" dir=in action=allow program="%CD%\RayLinkCapturer.exe" protocol=tcp enable=yes profile=private
cmd /c netsh advfirewall firewall add rule name="RayLinkCapturer" dir=in action=allow program="%CD%\RayLinkCapturer.exe" protocol=udp enable=yes profile=private

cmd /c netsh advfirewall firewall delete rule name="RayLinkWatch"
cmd /c netsh advfirewall firewall add rule name="RayLinkWatch" dir=in action=allow program="%CD%\RayLinkWatch.exe" protocol=tcp enable=yes profile=public
cmd /c netsh advfirewall firewall add rule name="RayLinkWatch" dir=in action=allow program="%CD%\RayLinkWatch.exe" protocol=udp enable=yes profile=public
cmd /c netsh advfirewall firewall add rule name="RayLinkWatch" dir=in action=allow program="%CD%\RayLinkWatch.exe" protocol=tcp enable=yes profile=domain
cmd /c netsh advfirewall firewall add rule name="RayLinkWatch" dir=in action=allow program="%CD%\RayLinkWatch.exe" protocol=udp enable=yes profile=domain
cmd /c netsh advfirewall firewall add rule name="RayLinkWatch" dir=in action=allow program="%CD%\RayLinkWatch.exe" protocol=tcp enable=yes profile=private
cmd /c netsh advfirewall firewall add rule name="RayLinkWatch" dir=in action=allow program="%CD%\RayLinkWatch.exe" protocol=udp enable=yes profile=private
:end