Search code examples
batch-filewindows-firewall

modify Windows Firewall with command prompt


using Command Prompt to modify Windows Firewall

can i allow Domain/Public/Private checkmarks all in the same row (like i can do by manually clicking)?

what i have so far makes 3 entries, one checkmark for each type:

netsh advfirewall firewall add rule name="MyApp" dir=in action=allow program="C:\MyApp.exe" enable=yes profile=domain

netsh advfirewall firewall add rule name="MyApp" dir=in action=allow program="C:\MyApp.exe" enable=yes profile=public

netsh advfirewall firewall add rule name="MyApp" dir=in action=allow program="C:\MyApp.exe" enable=yes profile=private


Solution

  • Here's what you can do to solve it:

    profile=Private and/or public and/or domain
    (To add rule in more than one profile use “,” E.g.: profile=private, domain )