@echo on
title CenTL Viewer: Configuring Windows Firewall
prompt GenTL Setup:: 
REM                                                                                                                       
REM $------------------------------------------------------------------$  
REM                                                                       
REM $Workfile::                                                        $  
REM $Revision::                                                        $  
REM $Date::                                                            $  
REM $Author::                                                          $  
REM                                                                       
REM $------------------------------------------------------------------$  
REM                                                                       
REM $Description::                                                     $  
REM Opens up windows firewall to allow GenTL GigE packets through
REM                                                                       
REM $------------------------------------------------------------------$  
REM                                                                       
REM $History::                                                         $  
REM                                                                       
REM $------------------------------------------------------------------$  
REM                                                                       
REM    o  0                                                               
REM    | /       Copyright (c) 20022                                       
REM   (CL)---o   Critical Link, LLC                                       
REM     \                                                                 
REM      O                                                                
REM ***********************************************************************

if ""=="%1" goto errExit
if ""=="%2" goto errExit
set mainapp=%~1
if "uninstall"=="%2" goto uninstall
set rule="GenTL Viewer"
:install
    @echo on
		netsh advfirewall firewall add rule name=%rule% dir=in action=allow program="%mainapp% enable=yes
	@goto end
    
:uninstall
    @echo on
	netsh advfirewall firewall delete rule name=%rule% program="%mainapp%
    @goto end
    
:end
    netsh advfirewall firewall show rule %rule%
    REM @pause
    @goto :EOF
    
:errExit
    echo Usage:
    echo     %0 ^<program^> ^<install^|uninstall^>
    
exit /b 0