How to create shortcut for Windows Firewall rule (enable/disable)?


  1. Posts : 13
    Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
       #1

    How to create shortcut for Windows Firewall rule (enable/disable)?


    Hello,

    hopefully this is right subforum to start this thread :)
    I've googled on how to quickly and easily enable/disable single Windows Firewall rule without having to open the firewall, going into advanced options, and eventually manually finding my rule there.
    Best I've found was two commands when searching for 'shortcut':

    run, netsh advfirewall firewall set rule name="NameOfFirewallRule" new enable=yes

    and

    run, netsh advfirewall firewall set rule name="NameOfFirewallRule" new enable=no

    Firstly, I don't know how to use them (how do I create shortcut containing the above lines) or if they work at all.
    Then, perhaps there is an easier way to quickly disable/enable single rule in Windows 7 firewall?

    I did search the Tutorials section here, but only found how to make shortcut for whole Windows Firewall, which is not what I'm after:)
      My Computer


  2. Posts : 598
    Windows 7 Ultimate x64
       #2

    I use a program called Windows Firewall Control, which is not a standalone program, rather it gives the Windows 7 platform an easy to use advanced GUI to control rules and edit them as you see fit. Here is the link : Windows Firewall Control
      My Computer


  3. Posts : 2,465
    Windows 7 Ultimate x64
       #3

    Simply put that line in a bat file each, one for enabling, other for disabling, name them as you like and put in desktop or wherever you find them comfortable.

    Remember that since firewall is a system-wide setting, you must run them as administrator.
      My Computer


  4. Posts : 13
    Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
    Thread Starter
       #4

    Thanks for both replies! While the program linked does the job, I'm curious to make the .bat files work as advised by Alejandro85. I put the commands (exactly as typed in first message updated with rule's name) in two txt files, then renamed the extensions to .bat. I right click them and click 'run as administrator', accept UAC prompt, but the cmd windows blinks for a split second and nothing happens, the rule remains in its current state.

    Ok I managed to print screen the error message:

    C:\Windows\system32\run, netsh advfirewall firewall set rule name="XYZ" new enable=yes
    'run' is not recognized as an internal or external command, operable program or batch file.

    I've no idea what this means and what to do with it. More help will be appreciated:)
    Last edited by solshine2510; 30 Nov 2013 at 05:44.
      My Computer


  5. Posts : 2,465
    Windows 7 Ultimate x64
       #5

    The error says that "run" isn't a known command and Windows don't knows what to do with it. In fact, the "run" thing is wrong, the actual command is netsh, no idea where came that run from. Just start the command with netsh and everything that follows will do.

    A handy trick for troubleshooting bat files is to add a "pause" command at the end (in a new line) so it ask you to press a key before closing, giving time for you to read the outcome.
      My Computer


  6. Posts : 13
    Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
    Thread Starter
       #6

    Thanks for reply, everything working correctly now :)
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 11:17.
Find Us