How to Block a Program from Accessing the Internet in Windows 11 / 10 (CMD & 1-Click Fix)

Quick Answer: How to Block an App via Command Prompt

To block any application from accessing the internet in Windows 11 or 10, open an elevated Command Prompt and run: netsh advfirewall firewall add rule name="Block_App_Out" dir=out action=block program="C:\Path\To\Program.exe" enable=yes profile=any. To block incoming connections as well, run the same command with dir=in. For instant drag-and-drop isolation with zero command typing, download the free 82 KB Pexoris FirewallBlocker.

The Default Windows Firewall Blind Spot: Outbound Traffic

Windows Defender Firewall has protected PCs since Windows XP Service Pack 2. However, Microsoft made a deliberate architectural choice that surprises many users: Windows Firewall blocks unsolicited inbound traffic by default, but allows virtually all outbound traffic without prompting.

This means that whenever you install an application—whether it is a photo editor, video converter, or utility—it has unrestricted permission to:

To prevent a program from transmitting data, you must configure explicit Outbound Block rules. Below are the two most reliable methods: native command-line syntax and 1-click drag-and-drop isolation.

Block Any App with Drag & Drop

Pexoris FirewallBlocker adds native Outbound & Inbound block rules across all network profiles with 1 click. Zero installation, 82 KB portable tool.

Get Pexoris FirewallBlocker →

Method 1: Block Programs via Command Prompt (netsh)

The native Windows command line utility netsh advfirewall firewall allows you to create firewall rules programmatically without opening the slow Management Console (MMC) snap-in.

  1. Press Win + X and select Terminal (Admin) or Command Prompt (Run as administrator).
  2. Execute the following command to block outbound connections:
:: 1. Block Outbound Connection (Replaces C:\Path\To\App.exe with your real path)
netsh advfirewall firewall add rule name="BlockedApp_Out" dir=out action=block program="C:\Program Files\ExampleApp\app.exe" enable=yes profile=any

:: 2. Block Inbound Connection (Complete Network Isolation)
netsh advfirewall firewall add rule name="BlockedApp_In" dir=in action=block program="C:\Program Files\ExampleApp\app.exe" enable=yes profile=any

To verify that your rule is successfully registered and active in Windows Filtering Platform (WFP), run:

netsh advfirewall firewall show rule name="BlockedApp_Out"

Method 2: How to Unblock or Remove the Rule

If you ever need to restore internet connectivity to the blocked application, execute the delete rule command:

:: Remove the outbound and inbound rules
netsh advfirewall firewall delete rule name="BlockedApp_Out"
netsh advfirewall firewall delete rule name="BlockedApp_In"

Method 3: How to Block Windows Telemetry via Firewall

Windows 11 constantly runs background telemetry engines that send hardware inventory, app crash data, and user experience metrics back to Microsoft servers. You can block the primary telemetry executors with native rules:

:: Block Microsoft Compatibility Appraiser
netsh advfirewall firewall add rule name="Block_CompatTel" dir=out action=block program="%windir%\System32\CompatTelRunner.exe" enable=yes profile=any

:: Block Device Census Telemetry
netsh advfirewall firewall add rule name="Block_DeviceCensus" dir=out action=block program="%windir%\System32\DeviceCensus.exe" enable=yes profile=any

With Pexoris FirewallBlocker, you don't need to copy and paste command lines—simply click 🛡️ Block Telemetry to automatically identify and isolate all telemetry executables with one click.

Important Pitfall: Background Updaters in AppData

When blocking modern desktop applications (such as Discord, Spotify, or creative software suites), remember that the executable that launches from your desktop shortcut is often just a loader or child process. The actual network worker or background updater often resides in:

If the app continues to update or connect, open Windows Task Manager (Ctrl + Shift + Esc), expand the app's processes, right-click the active networking worker, click Open file location, and drag that specific .exe into Pexoris FirewallBlocker to isolate it.