How to Disable Windows Firewall With Command Line

Firewallis a tricky thing in Windows. It restricts your downloads at times, stops you from remotely connecting to a PC and blocks applications from running, which is quite irritating. But so far this is a top-notch security feature provided by Windows if you know how to use it right. You can configure your firewall to block particular applications from using the Internet and securing your local data.

Block applications from accessing the Internet with GUI is easy. simply go to theStartmenu and search forFirewall & Network protection.From the dialogue box, click onDomain Networkand turn theFirewallOff. Likewise, you have to turn off the firewall for Private Network and Public Network. In case you need to turn off the firewall only for the Internet, turn off the Firewall only for Public Network.

cmd_runas_admin

Disable Windows Firewall With Command Line

However, if you are like me who prefer to disable Windows firewall with the command line, here’s a quick way to do it on Windows 10 and 7.

Open up thecommand prompt. Go to the Start menu, typeCommand Prompt. Right click on it and selectRun as Administrator. This command to disable Firewall needs elevated permissions, so it needs to be run as an administrator.

cmd_disable_firewall

On the command prompt, Type

This will turn off the firewall for all 3 networks. To turn it back on, replace off with on.

Article image

Much like the terminal in macOS and Linux, Windows cmd also lets you move through your last used commands using the up and down arrows on your keyboard. So, if you wanted to previous last command you ran, just hit the up arrow once, edit the command (change off to on) and hit Enter.

Block Any App in the firewall (Command Line)

To block any app in the firewall, we first need to understand what is the inbound and the outbound rule. Inbound rules are defined to either block/allow the app from receiving data on your computer. Outbound rules are defined to either block/allow the application to send data from your computer.

To block any in Firewall using GUI is easy. All you have to do is go to theFirewall & Network Protection.

cmd_to_block_chrome

ClickAdvanced Settingsand go to theOutboundrules tab. Click onNew Ruleon the right-hand side of the window. Select Rule Type asProgramfrom the pop-up. Click onNextand further steps like specifying program path are self-explanatory.

However, doing the same with the command prompt is not that intuitive. First, you need to decide whether you need to block the app from receiving or sending data from the Internet. Say, you want to block Chrome app from accessing the Internet.

chrome_blocked_internet

Next, we need to find the location of the .exe file in our system. Usually, it should be in C:\Program Files, unless you have defined it manually.

Go to the .exe file and copy the path name. In my case for google chrome, the path would be :

Once you have the file location, all you have to do is open Command Prompt with administrator privilege and type the following command :

Now when I open chrome, internet access is disabled.

Block Any App in the Firewall with its Port Number

In case you want to block the app by port number. First, you have to identify the port number. To do that, go to Start menu and type Resource Monitor. Right click on it and select Run as Administrator.

Once the dialogue box opens, go to the Network tab and expand the Listening Ports section by clicking on it.

Once you have the port number use the following command to block that particular port.

If you are not sure about the exact port number you may also choose to block a range of ports by specifying port=1000-2000.

To delete this outbound rule, type the below give command with the name of the rule you have specified earlier.

This should fix things and Chrome should be able to access the Internet.

Wrapping Up

These methods enable you to block any particular application from accessing the Internet. This can be used against fishy apps to protect your data from being sent over to private networks or the Internet. If you have any problems with the step, you can comment the error and I can help you out with the solution.

Read:How to Reset TCP/IP in Windows, Linux, and macOS

Pratik works as an In-house writer and video host at TechWiser. Former Programmer, Current writer. Loves tech in any form, quite optimistic about AI, data science and IoT. Talks extremely less but you betcha can geek out over anything on Twitter.

Is New Camera Coach Feature on Pixel 10 Worth The…

What’s Coming and Leaving Hulu Soon (August 2025)

What’s Coming to Apple TV+ in August 2025

Today’s Jumble Answers (July 19, 2025)

Longest Snapchat Streak (August 2025) – And How to Keep…

Samsung One UI Status Bar Icons and Symbols Meaning

Safari Icons and Symbols Meaning – Complete Guide

What Do Icons and Symbols Mean on Slack? Complete Guide

Coffee Meets Bagel (CMB) Icons and Symbols Meaning? Complete Guide

What Do Icons and Symbols Mean on OkCupid? Complete Guide

You must belogged into post a comment.