BCUninstaller/Bulk-Crap-Uninstaller · error · Exception

Program is not recognized as an internal or external command

Error message

Program is not recognized as an internal or external command, operable program or batch file.

What it means

The exit-code switch maps exitVar == 9009 to a thrown Exception 'Program is not recognized as an internal or external command...'. Exit code 9009 is the cmd.exe error when the executable name could not be resolved — i.e. the command line was run through cmd and the first token is not a valid executable on PATH.

Source

Thrown at source/UninstallTools/Uninstaller/BulkUninstallEntry.cs:443

                            {
                                /* 3221225786 / 0xC000013A / -1073741510 
                                    The application terminated as a result of a CTRL+C. 
                                    Indicates that the application has been terminated either by user's 
                                    keyboard input CTRL+C or CTRL+Break or closing command prompt window. */
                                _skipLevel = SkipCurrentLevel.Terminate;
                            }
                            else
                            {
                                switch (exitVar)
                                {
                                    case 2:
                                        throw new Exception("The system cannot find the file specified. Indicates that the file can not be found in specified location.");
                                    case 3:
                                        throw new Exception("The system cannot find the path specified. Indicates that the specified path can not be found.");
                                    case 5:
                                        throw new Exception("Access is denied. Indicates that user has no access right to specified resource.");
                                    case 9009:
                                        throw new Exception("Program is not recognized as an internal or external command, operable program or batch file.");
                                    case -2147024846:
                                        throw new Exception("0x80070032 - This app is part of Windows and cannot be uninstalled on a per-user basis.");

                                    default:
                                        if (options.RetryFailedQuiet || (UninstallerEntry.UninstallerKind == UninstallerType.Nsis && !options.PreferQuiet))
                                            retry = true;
                                        throw new IOException(Localisation.UninstallError_UninstallerReturnedCode + exitVar);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                error = ex;
                Trace.WriteLine(@$"Exception when uninstalling {UninstallerEntry.DisplayName}: {ex}");
            }

View on GitHub (pinned to 608321de98)

Solutions

  1. Resolve the executable to an absolute path (File.Exists + Path.GetFullPath) before launching; do not rely on PATH.
  2. Set WorkingDirectory to the install folder so bare names resolve, or rewrite the command to use the full path.
  3. Avoid launching uninstallers through cmd.exe when a direct executable path is available.

Example fix

// before
startInfo.FileName = "uninstall.exe";
var p = Process.Start(startInfo);

// after
var exe = Path.Combine(installDir, "uninstall.exe");
if (!File.Exists(exe)) throw new FileNotFoundException(exe);
startInfo.FileName = exe;
startInfo.WorkingDirectory = installDir;
var p = Process.Start(startInfo);
Defensive patterns

Strategy: validation

Validate before calling

var exe = Path.Combine(entry.InstallLocation, FirstToken(entry.UninstallString));
if (!File.Exists(exe))
{
    exe = ResolveOnPath(FirstToken(entry.UninstallString));
    if (exe == null) { entry.MarkManualOnly(); return; }
}
startInfo.FileName = exe;
startInfo.WorkingDirectory = entry.InstallLocation;
manager.RunUninstaller(entry, options);

Type guard

null

Try / catch

null

Prevention

When it happens

Trigger: The UninstallString was launched via cmd.exe (or UseShellExecute=false with a bare command name) and the executable name is misspelled, not on PATH, or the command line had its executable stripped by incorrect quoting.

Common situations: Vendor uninstall string is a bare macro (e.g. 'uninstall.exe') expecting to be run from its own folder, but WorkingDirectory was wrong; PATH differs under the spawned context; the command line was parsed and the exe token lost.

Related errors


AI-assisted analysis of BCUninstaller/Bulk-Crap-Uninstaller@608321de98 (2026-08-13). Data as JSON: /api/errors/251dbd5959e10607. Report an issue: GitHub.