TC buttons to turn Firewall on/off
Moderators: Hacker, petermad, Stefan2, white
TC buttons to turn Firewall on/off
Hi,
For testing purposes I regularly have to turn Firewall off temorarily and turn it back on afterwards.
To speed this up, is it posiible to create a button in TC for each action: "Firewall on"-button & "Firewall off"-button?
I guess this is possible with a custom command, but I have no clue of the code that should be written in the command ...
Can anyone help, please?
In case Windows-version is important: I'm running Windows 11
Using Total Commander Portable 10.00 64 bit
Thanks in advance!
For testing purposes I regularly have to turn Firewall off temorarily and turn it back on afterwards.
To speed this up, is it posiible to create a button in TC for each action: "Firewall on"-button & "Firewall off"-button?
I guess this is possible with a custom command, but I have no clue of the code that should be written in the command ...
Can anyone help, please?
In case Windows-version is important: I'm running Windows 11
Using Total Commander Portable 10.00 64 bit
Thanks in advance!
Re: TC buttons to turn Firewall on/off
If you turn on/off your firewall using a registry file you can create two button/command to turn on/off launching dedicated reg file as admin.
If you want a single on/off command you will have to write yourself a powershell or whatecer script and then launch it from TC.
If you want a single on/off command you will have to write yourself a powershell or whatecer script and then launch it from TC.
Re: TC buttons to turn Firewall on/off
Hi,
Thanks for the info.
I don't know how to create a registry file or how to write a powershell or whatever script.
Can anyone help me out with that?
Thanks in advance!
Thanks for the info.
I don't know how to create a registry file or how to write a powershell or whatever script.
Can anyone help me out with that?
Thanks in advance!
Re: TC buttons to turn Firewall on/off
One important thing: There's not just a simple on/off switch for "the firewall". It depends on the current network the system thinks it is in. Each network can have a separate profile for which the firewall can be enabled or disabled. This can be useful to disable the firewall when a system is on the home network but it's still enabled when in a public place/network.
Enable firewall for the current active profile:I've found this command here https://www.thewindowsclub.com/netsh-command-to-manage-windows-firewall.
To disable the firewall for the current profile, replace "on" with "off". The command must be run as administrator.
Setting a registry value probably won't work without a system reboot.
Enable firewall for the current active profile:
Code: Select all
%SystemRoot%\system32\netsh.exe advfirewall set currentprofile state on
To disable the firewall for the current profile, replace "on" with "off". The command must be run as administrator.
Setting a registry value probably won't work without a system reboot.
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Re: TC buttons to turn Firewall on/off
Hi,
Tried this, but that didn't work:
Also tried it without the * in front of it, and then right-clicking on the button > As Administrator, but that didn't work either.
Have tried those methods in an em_ command as well, but that also didn't work.
Am I doing something wrong? Does it work on your end?
Tried this, but that didn't work:
Code: Select all
TOTALCMD#BAR#DATA
*%SystemRoot%\system32\netsh.exe advfirewall set currentprofile state off
FirewallControlPanel.dll,1
-1
Have tried those methods in an em_ command as well, but that also didn't work.
Am I doing something wrong? Does it work on your end?
Re: TC buttons to turn Firewall on/off
Try the command on a separate CMD first before putting it on a button to see if any error occurs and which one. I can't test the command because I have the Windows Firewall service disabled on all my VMs (and I won't test it on my production system).
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Re: TC buttons to turn Firewall on/off
Button Firewall off:
Code: Select all
TOTALCMD#BAR#DATA
*%SystemRoot%\system32\netsh.exe
advfirewall set currentprofile state off
%SystemRoot%\system32\imageres.dll,100
Firewall off
1
-1
Code: Select all
TOTALCMD#BAR#DATA
*%SystemRoot%\system32\netsh.exe
advfirewall set currentprofile state on
%SystemRoot%\system32\imageres.dll,101
Firewall on
1
-1
For more control over the Windows firewall I suggest WFC.