{"record":{"id":"251dbd5959e10607","repo":"BCUninstaller/Bulk-Crap-Uninstaller","slug":"program-is-not-recognized-as-an-internal-or-extern","errorCode":null,"errorMessage":"Program is not recognized as an internal or external command, operable program or batch file.","messagePattern":"Program is not recognized as an internal or external command, operable program or batch file\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"source/UninstallTools/Uninstaller/BulkUninstallEntry.cs","lineNumber":443,"sourceCode":"                            {\r\n                                /* 3221225786 / 0xC000013A / -1073741510 \r\n                                    The application terminated as a result of a CTRL+C. \r\n                                    Indicates that the application has been terminated either by user's \r\n                                    keyboard input CTRL+C or CTRL+Break or closing command prompt window. */\r\n                                _skipLevel = SkipCurrentLevel.Terminate;\r\n                            }\r\n                            else\r\n                            {\r\n                                switch (exitVar)\r\n                                {\r\n                                    case 2:\r\n                                        throw new Exception(\"The system cannot find the file specified. Indicates that the file can not be found in specified location.\");\r\n                                    case 3:\r\n                                        throw new Exception(\"The system cannot find the path specified. Indicates that the specified path can not be found.\");\r\n                                    case 5:\r\n                                        throw new Exception(\"Access is denied. Indicates that user has no access right to specified resource.\");\r\n                                    case 9009:\r\n                                        throw new Exception(\"Program is not recognized as an internal or external command, operable program or batch file.\");\r\n                                    case -2147024846:\r\n                                        throw new Exception(\"0x80070032 - This app is part of Windows and cannot be uninstalled on a per-user basis.\");\r\n\r\n                                    default:\r\n                                        if (options.RetryFailedQuiet || (UninstallerEntry.UninstallerKind == UninstallerType.Nsis && !options.PreferQuiet))\r\n                                            retry = true;\r\n                                        throw new IOException(Localisation.UninstallError_UninstallerReturnedCode + exitVar);\r\n                                }\r\n                            }\r\n                        }\r\n                    }\r\n                }\r\n            }\r\n            catch (Exception ex)\r\n            {\r\n                error = ex;\r\n                Trace.WriteLine(@$\"Exception when uninstalling {UninstallerEntry.DisplayName}: {ex}\");\r\n            }\r","sourceCodeStart":425,"sourceCodeEnd":461,"githubUrl":"https://github.com/BCUninstaller/Bulk-Crap-Uninstaller/blob/608321de98e92297377b1eb69029af55c25504a1/source/UninstallTools/Uninstaller/BulkUninstallEntry.cs#L425-L461","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Resolve the executable to an absolute path (File.Exists + Path.GetFullPath) before launching; do not rely on PATH.","Set WorkingDirectory to the install folder so bare names resolve, or rewrite the command to use the full path.","Avoid launching uninstallers through cmd.exe when a direct executable path is available."],"exampleFix":"// before\nstartInfo.FileName = \"uninstall.exe\";\nvar p = Process.Start(startInfo);\n\n// after\nvar exe = Path.Combine(installDir, \"uninstall.exe\");\nif (!File.Exists(exe)) throw new FileNotFoundException(exe);\nstartInfo.FileName = exe;\nstartInfo.WorkingDirectory = installDir;\nvar p = Process.Start(startInfo);","handlingStrategy":"validation","validationCode":"var exe = Path.Combine(entry.InstallLocation, FirstToken(entry.UninstallString));\nif (!File.Exists(exe))\n{\n    exe = ResolveOnPath(FirstToken(entry.UninstallString));\n    if (exe == null) { entry.MarkManualOnly(); return; }\n}\nstartInfo.FileName = exe;\nstartInfo.WorkingDirectory = entry.InstallLocation;\nmanager.RunUninstaller(entry, options);","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Always resolve bare command names to absolute paths before launching.","Set WorkingDirectory to the install folder so bare names resolve.","Avoid routing uninstall commands through cmd.exe when a direct exe path is available."],"tags":["uninstaller","process-exit-code","exit-code-9009","path-resolution","cmd"],"backgroundTag":null,"analyzedSha":"608321de98e92297377b1eb69029af55c25504a1","analyzedAt":"2026-08-13T12:17:35.389Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}