Last active
          January 25, 2025 10:10 
        
      - 
      
 - 
        
Save David-Lor/26ab506c1809ec1ff1dcf238c6213f79 to your computer and use it in GitHub Desktop.  
    Block internet access to GTA V
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | :: Disable the rule == Enable internet | |
| set RULE_NAME=GTA5_BLOCK | |
| netsh advfirewall firewall set rule name="%RULE_NAME%" dir=in new enable=no | |
| netsh advfirewall firewall set rule name="%RULE_NAME%" dir=out new enable=no | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | :: Enable the rule == Block internet | |
| set RULE_NAME=GTA5_BLOCK | |
| netsh advfirewall firewall set rule name="%RULE_NAME%" dir=in new enable=yes | |
| netsh advfirewall firewall set rule name="%RULE_NAME%" dir=out new enable=yes | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | :: Create firewall rules to block GTA5.exe access to internet | |
| :: These rules will get enabled or disabled at will with the other two scripts | |
| :: source: https://superuser.com/questions/1350555/is-it-possible-to-block-an-application-from-accessing-the-internet-with-cmd | |
| set RULE_NAME=GTA5_BLOCK | |
| :: Change the following with your installation directory, plus the GTA5.exe at the end | |
| set PROGRAM=C:\Program Files (x86)\Steam\steamapps\common\Grand Theft Auto V\GTA5.exe | |
| netsh advfirewall firewall add rule name="%RULE_NAME%" dir=in action=block profile=any program="%PROGRAM%" | |
| netsh advfirewall firewall add rule name="%RULE_NAME%" dir=out action=block profile=any program="%PROGRAM%" | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
Maybe you can block GTA5.exe in Windows Firewall completely (https://nordpass.com/blog/how-to-block-program-in-firewall/)