Disable and enable firewall from command line: Windows XP
If you need quickly to disable or enable the firewall on Windows XP, you can enable or disable it right away using the command line or a dedicated file. Follow the steps below to learn how to do so.
Using the command line
Under Windows XP SP2, it is possible to enable or disable the firewall with the following command lines.
- First, open the command prompt: (Windows + R keys) and type: cmd
- To disable the Windows XP firewall, type: netsh firewall set opmode disable
- To enable the Windows XP firewall, type: netsh firewall set opmode enable
- Validate with the Enter key.
Using a BAT file
It is also possible to create a batch file (a file with the .bat) incorporating one of these commands to enable or disable the firewall by simply double-clicking on the file.
You can create a batch file to enable or disable the firewall by double-clicking on Notepad and inserting one of two lines above, then saving the file with the .bat extension (ex: Activatefirewall.bat).
To go further, you can create two files on the desktop, one to enable and the other to disable the firewall.
To create the file to enable your firewall:
- Open the Notepad text editor and create a new file
- Type: netsh firewall set opmode enable
- Click on File/Save As
- In "File name" write "Enablefirewall.bat"
- Save directly on your desktop
- Double-click on this file to disable the firewall in Windows XP
To create the file to disable your firewall:
- Open the Notepad text editor and create a new file
- Type: netsh firewall set opmode disable
- Click on File/Save As
- In "File name" write "Disablefirewall.bat"
- Save directly on your desktop
- Double-click on this file to disable the firewall in Windows XP