Skip to content

Instantly share code, notes, and snippets.

@David-Lor
Last active January 25, 2025 10:10
Show Gist options
  • Save David-Lor/26ab506c1809ec1ff1dcf238c6213f79 to your computer and use it in GitHub Desktop.
Save David-Lor/26ab506c1809ec1ff1dcf238c6213f79 to your computer and use it in GitHub Desktop.
Block internet access to GTA V
:: 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
:: 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
:: 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%"
@tomihomi
Copy link

hi, if I make a rule to block the internet of GTA5.exe it does tell me saving failed but I would like to get the same result as if I would disconnect the Internet completely, which usually leads to being forced back to single player and going offline in R* social club menu. Do you know which other Program I need to block in order to get that result?

@David-Lor
Copy link
Author

hi, if I make a rule to block the internet of GTA5.exe it does tell me saving failed but I would like to get the same result as if I would disconnect the Internet completely, which usually leads to being forced back to single player and going offline in R* social club menu. Do you know which other Program I need to block in order to get that result?

Maybe you can block GTA5.exe in Windows Firewall completely (https://nordpass.com/blog/how-to-block-program-in-firewall/)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment