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

solshine2510

New member
Local time
5:06 AM
Messages
13
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 My Computer

At a glance

Microsoft Windows 7 Home Premium 64-bit 7601 ...AMD Phenom(tm) II X4 955 Processor4,00 GBAMD Radeon HD 6800 Series
OS
Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
CPU
AMD Phenom(tm) II X4 955 Processor
Motherboard
ASRock 870iCafe
Memory
4,00 GB
Graphics Card(s)
AMD Radeon HD 6800 Series
Sound Card
(1) SB X-Fi Surround 5.1 (2) High Definition Audio Device
Screen Resolution
1920 x 1080 x 32 bits (4294967296 colors) @ 60 Hz
Hard Drives
SAMSUNG HD502HJ ATA Device
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 My Computer

At a glance

Windows 7 Ultimate x64FX 8350 @ 4.8ghz, turbo clocked to 5.4ghzMushkin Enhanced Blackline 16GB 1760mhz 10-10...Gigabyte-660 Windforce OC- GPU Clock 1212MHz ...
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Custom Build
OS
Windows 7 Ultimate x64
CPU
FX 8350 @ 4.8ghz, turbo clocked to 5.4ghz
Motherboard
Asus Sabertooth FX990 Gen 3.0 R2.0
Memory
Mushkin Enhanced Blackline 16GB 1760mhz 10-10-9-24 T1
Graphics Card(s)
Gigabyte-660 Windforce OC- GPU Clock 1212MHz /3504MHz ram
Sound Card
Creative Sound Blaster Recon3D PCIe Sound Card
Monitor(s) Displays
Samsung SyncMaster S27B350H (HDMI)
Screen Resolution
1920x1080 60HZ
Hard Drives
1 x SSD Crucial M4 256GB (Primary OS)
3 x HDD WD 1TB
4 x HDD 2TB
1 x HDD 160GB (Secondary Backup OS)
Raid SATA III 6GB/s 4-port PCI-e Controller Card, Marvel 88SE9215 chipset
PSU
Chieftec-650-14CS (Modular) 80 Plus Gold-650 Watt
Case
Akasa Venom Toxic Gaming Big tower ( Custom Black ) Ver 2.0
Cooling
Water 2.0 PRO / GEIL Cyclone VRM / 6x120mm 2x220mm 2x140mm
Keyboard
Logitech G19
Mouse
Wireless Notebook Presenter Mouse 8000
Internet Speed
Fiber GBS
Antivirus
Don't Announce it to the world :)
Browser
Gotta have at least 1!
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 My Computer

At a glance

Windows 7 Ultimate x64Intel Core i7-740QM8 GB DDR3NVIDIA GeForce 330GT
Computer type
Laptop
Computer Manufacturer/Model Number
Toshiba Sattelite A665-S6092
OS
Windows 7 Ultimate x64
CPU
Intel Core i7-740QM
Memory
8 GB DDR3
Graphics Card(s)
NVIDIA GeForce 330GT
Screen Resolution
1366x768
Hard Drives
Samsung 840 SSD 500GB
1TB USB3 external HD
Cooling
Coolermaster Notepal U3 notebook cooling pad
Internet Speed
3mbps ASDL
Antivirus
ClamWin 0.98.7
Browser
Opera 12.17 x86 (main), Firefox 38 (sec), IE11 (last resort)
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:

My Computer My Computer

At a glance

Microsoft Windows 7 Home Premium 64-bit 7601 ...AMD Phenom(tm) II X4 955 Processor4,00 GBAMD Radeon HD 6800 Series
OS
Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
CPU
AMD Phenom(tm) II X4 955 Processor
Motherboard
ASRock 870iCafe
Memory
4,00 GB
Graphics Card(s)
AMD Radeon HD 6800 Series
Sound Card
(1) SB X-Fi Surround 5.1 (2) High Definition Audio Device
Screen Resolution
1920 x 1080 x 32 bits (4294967296 colors) @ 60 Hz
Hard Drives
SAMSUNG HD502HJ ATA Device
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 My Computer

At a glance

Windows 7 Ultimate x64Intel Core i7-740QM8 GB DDR3NVIDIA GeForce 330GT
Computer type
Laptop
Computer Manufacturer/Model Number
Toshiba Sattelite A665-S6092
OS
Windows 7 Ultimate x64
CPU
Intel Core i7-740QM
Memory
8 GB DDR3
Graphics Card(s)
NVIDIA GeForce 330GT
Screen Resolution
1366x768
Hard Drives
Samsung 840 SSD 500GB
1TB USB3 external HD
Cooling
Coolermaster Notepal U3 notebook cooling pad
Internet Speed
3mbps ASDL
Antivirus
ClamWin 0.98.7
Browser
Opera 12.17 x86 (main), Firefox 38 (sec), IE11 (last resort)
Thanks for reply, everything working correctly now :)
 

My Computer My Computer

At a glance

Microsoft Windows 7 Home Premium 64-bit 7601 ...AMD Phenom(tm) II X4 955 Processor4,00 GBAMD Radeon HD 6800 Series
OS
Microsoft Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
CPU
AMD Phenom(tm) II X4 955 Processor
Motherboard
ASRock 870iCafe
Memory
4,00 GB
Graphics Card(s)
AMD Radeon HD 6800 Series
Sound Card
(1) SB X-Fi Surround 5.1 (2) High Definition Audio Device
Screen Resolution
1920 x 1080 x 32 bits (4294967296 colors) @ 60 Hz
Hard Drives
SAMSUNG HD502HJ ATA Device
Back
Top