How to Fix “Firewall Cmd Command Not Found” Error on Windows

Seeing the error “firewall cmd command not found” can be frustrating when trying to configure your Windows Firewall. This typically appears when running firewall commands from the command prompt or PowerShell, indicating the executable cannot be found.

Don’t worry – in most cases this issue can be easily resolved. Here we’ll cover the main causes and solutions to fix the “firewall cmd command not found” error on Windows.

Why You Get the “Firewall Cmd Not Found” Error

There are a couple reasons why you might see "firewall cmd" failing with the command not found error:

The firewall executables are not in your PATH. Windows searches directories defined in the PATH environment variable when you run a command. If the location of firewall.exe is missing from PATH, you’ll get the not found error.

The firewall service is disabled or not running. The firewall daemon must be active for the netsh firewall and firewall.exe commands to work properly. If the firewall service is stopped, commands will fail.

You have a typo in the command. It’s easy to mistype "fw cmd" or "firewalld cmd". Double check that you correctly typed "firewall cmd".

You’re running an unsupported command. Some firewall commands like "netsh advfirewall" only work on newer Windows versions. Using them on old Windows releases will result in an error.

Below we’ll cover how to troubleshoot and fix these potential issues when you see the firewall command not found error.

Enable and Start the Windows Firewall Service

Before troubleshooting other causes, verify that the Windows Firewall service is both enabled and actively running on your system.

  1. Open the Start Menu and search for “services”. Open the Services management console.
  2. Scroll down and check the status of the service named Windows Firewall. Status: Running (or Started) Startup Type: Automatic (or Automatic Delayed Start)
  3. If the Firewall service is not Running/Started, right-click it and select Start to manually activate it.
  4. If Startup Type is Disabled or Manual, double click the service and change it to Automatic or Automatic Delayed Start.

Now with the core firewall service restored, firewall commands should begin working again in many cases.

Bolded Header: Check if this resolved your “firewall cmd not found” error before continuing. Try running a simple command like "firewall.exe" or "netsh firewall show state" to test it.

Add Windows\System32 to Your PATH

If starting the Firewall service did not fix the problem, the likely culprit is a missing PATH variable. Windows searches the defined PATH directories to find and launch executables like firewall.exe when you run commands.

Follow these steps to add the System32 folder where firewall.exe resides to your user or system PATH:

Add System32 to User PATH Variable

  1. Open the Start Menu and type “environment variables” to open your Environment Variables window.
  2. Under User Variables (or your username), find the PATH row and click Edit. Variable Name: PATH Variable Value: <Existing Directories>
  3. In Edit Environment Variable, click New and add the path C:\Windows\System32 on a new line.
  4. Click OK on any remaining dialogs to save the updated PATH variable.
  5. Open a new command prompt and verify the error is resolved when running firewall cmd.

Set System PATH Variable

Alternatively, you can add System32 to the system PATH used by all users and command prompts:

  1. Follow steps 1-2 above to open your Environment Variables, but navigate to System Variables instead.
  2. Find the System PATH variable and click Edit.
  3. Add C:\Windows\System32 on a new line. Click OK to save.
  4. Restart any open command prompts and test if firewall.exe now works.

With the firewall directory now searchable in PATH, "firewall cmd" and related commands should function properly at your command line.

Bolded Header: Troubleshoot the Windows Firewall Service

In some situations, you may need to manually restore or troubleshoot the core Firewall service to get commands working again after seeing “firewall cmd command not found”:

Reset Firewall Settings

Resetting components of the firewall service to their original state may help resolve issues:

netsh advfirewall reset
netsh firewall reset

After running resets, restart your PC and test if commands now work properly.

Register Firewall Dlls

You can also re-register firewall-related .dll files which sometimes become corrupted:

regsvr32 /u %SystemRoot%\system32\FirewallAPI.dll 
regsvr32 %SystemRoot%\system32\FirewallAPI.dll

This will unregister and re-register the firewall API dll, fixing potential dll issues stopping the service from running normally.

Check Startup Errors

Examine the Windows event log for clues on why the Firewall service fails to start automatically:

  1. Go to Start Menu > Event Viewer
  2. Expand Windows Logs > System
  3. Filter Current Log by Source = Service Control Manager
  4. Look for recent errors mentioning the Firewall service failing to start

Event log clues can reveal configuration problems or dependency issues blocking proper initialization of the firewall.

Bold Header: Still Seeing Firewall Command Not Found?

After enabling the firewall service, verifying PATH directories, and troubleshooting the daemon, firewall.exe commands should now work properly from your Windows command line.

If you are still getting a “firewall cmd command not found” or similar errors, a few other things to check:

  • Confirm you have administrative privileges when running firewall commands. Some may require admin access.
  • Check for typos – make sure you are typing "firewall" not mixing it up with "firewalld" or "fw".
  • Test on a new command prompt in case of corrupted environment.
  • Retry after rebooting your Windows machine.
  • Consider reinstalling firewall related Windows features if above steps fail.

And those are the most common ways to troubleshoot and fix the “firewall cmd command not found” error! The key is making sure the firewall service itself is enabled and running, and that the firewall.exe executable is locatable via your PATH environment variable.

Let me know if any parts of the instructions need more detail or if you have any other questions!

Leave a Comment