{"id":28839,"date":"2022-09-29T22:18:40","date_gmt":"2022-09-29T16:48:40","guid":{"rendered":"http:\/\/198.58.113.91\/blog\/?p=28839"},"modified":"2023-01-08T10:22:18","modified_gmt":"2023-01-08T04:52:18","slug":"cant-open-cmd-after-uninstalling-python-anaconda","status":"publish","type":"post","link":"https:\/\/www.winhelponline.com\/blog\/cant-open-cmd-after-uninstalling-python-anaconda\/","title":{"rendered":"Can&#8217;t Open CMD.exe After Uninstalling Python\/Anaconda; Exit Code 1"},"content":{"rendered":"<p>After uninstalling Python\/Anaconda on your Windows computer, Command Prompt may not open. When you run <code>cmd.exe<\/code>, it flashes on the screen and immediately quits. Also, running <a href=\"https:\/\/www.winhelponline.com\/blog\/repair-windows-10-using-dism-sfc\/\">DISM and SFC<\/a> (to repair corrupt system files), repairing Windows installation, and running a thorough malware scan may not fix the issue.<!--more--><\/p>\n<p>Also, when you open Command Prompt via the Terminal menu in Visual Studio Code, the following error (Error 1: &#8220;Incorrect function&#8221;) occurs:<\/p>\n<pre class=\"err\">The terminal process \"C:\\WINDOWS\\System32\\cmd.exe\" terminated with exit code: 1.<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-28844\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2022\/09\/vscode-cmd-error-code-1.png\" alt=\"vscode cmd.exe error 1\" width=\"484\" height=\"211\" \/><\/p>\n<p>If you had enabled <code><strong>conda init powershell<\/strong><\/code> and later uninstalled Anaconda, PowerShell might report the following error at every start:<\/p>\n<pre class=\"err\">The term 'C:\\ProgramData\\Anaconda3\\Scripts\\conda.exe' is not recognized as the name of a cmdlet, function, script\r\nfile, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct\r\nand try again.\r\nAt C:\\Users\\Ramesh\\Documents\\WindowsPowerShell\\profile.ps1:3 char:4<\/pre>\n<p>The <code>profile.ps1<\/code> file would have the following code in it, which auto-starts (PowerShell hook) whenever you launch PowerShell:<\/p>\n<pre>#region conda initialize\r\n# !! Contents within this block are managed by 'conda init' !!\r\n(&amp; \"C:\\ProgramData\\Anaconda3\\Scripts\\conda.exe\" \"shell.powershell\" \"hook\") | Out-String | Invoke-Expression\r\n#endregion<\/pre>\n<h2>Cause<\/h2>\n<p>This issue occurs due to an incorrect and leftover <code>Autorun<\/code> registry value after uninstalling Python.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-28841\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2022\/09\/autorun-cmd-processor-1.png\" alt=\"autorun command processor python\" width=\"590\" height=\"227\" \/><\/p>\n<pre>HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Command Processor<br aria-hidden=\"true\" \/>Autorun REG_SZ \"if exist\"<\/pre>\n<p>The value data might read &#8220;<code>if exist<\/code>&#8221; which CMD.exe executes at launch and closes automatically. Your Python\/Anaconda installation added the registry value. However, you should be able to launch Command Prompt correctly by running &#8220;<code>cmd.exe \/d<\/code>&#8220;.<\/p>\n<p><code>\/D<\/code>\u00a0 &#8211; Disable execution of AutoRun commands from the registry (see below)<\/p>\n<ul>\n<li data-prewrap=\"true\">If <code>\/D<\/code> was NOT specified on the command line, then when CMD.EXE starts, it looks for the following REG_SZ\/REG_EXPAND_SZ registry variables, and if either or both are present, they are executed first.\n<pre>HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Command Processor\\AutoRun<\/pre>\n<p>and\/or<\/p>\n<pre>HKEY_CURRENT_USER\\Software\\Microsoft\\Command Processor\\AutoRun<\/pre>\n<\/li>\n<\/ul>\n<p>The <strong>PowerShell<\/strong> error (&#8220;&#8216;conda.exe&#8217; is not recognized&#8221;) is caused by the script file <code>profile.ps1<\/code>, which was generated by the &#8220;<code>conda init powershell<\/code>&#8221; command you ran earlier. The script file will be located at <code>\"%Userprofile%\\Documents\\WindowsPowerShell\\profile.ps1\"<\/code>.<\/p>\n<h2>Resolution<\/h2>\n<h3>Command Prompt<\/h3>\n<p>To resolve the Command Prompt issue, delete the <code>Autorun<\/code> registry key. The <code>Autorun<\/code> value doesn&#8217;t exist by default in Windows and can be deleted.<\/p>\n<ol>\n<li>Open an admin Command Prompt window. To do so, type <code><strong>cmd.exe \/d<\/strong><\/code> in Start\/Run dialog, and press <kbd>Ctrl<\/kbd> + <kbd>Shift<\/kbd> + <kbd>Enter<\/kbd>. (<em>Ref: <a href=\"https:\/\/www.winhelponline.com\/blog\/run-command-elevated-administrator-ctrl-shift-enter-windows-10\/\">Start Programs Elevated from Run Dialog<\/a><\/em>)<\/li>\n<li>In the admin Command Prompt, type the following commands:\n<pre>reg.exe delete \"HKCU\\SOFTWARE\\Microsoft\\Command Processor\" \/v \"Autorun\" \/f<\/pre>\n<p>and then:<\/p>\n<pre>reg.exe delete \"HKLM\\SOFTWARE\\Microsoft\\Command Processor\" \/v \"Autorun\" \/f<\/pre>\n<p>In case you receive the following error, please ignore it:<\/p>\n<pre class=\"err\">ERROR: The system was unable to find the specified registry key or value.<\/pre>\n<\/li>\n<li>Exit the Command Prompt window.<\/li>\n<\/ol>\n<p>You should be able to launch <code>cmd.exe<\/code> (with or without the <code>\/d<\/code> parameter) now.<\/p>\n<h3>PowerShell or Terminal Error<\/h3>\n<p>To fix the &#8220;conda.exe is not recognized as the name of a cmdlet&#8221; error in PowerShell, delete the &#8220;<code>profile.ps1<\/code>&#8221; file located under your &#8220;<code>\\Documents\\WindowsPowerShell\\<\/code>&#8221; directory.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>After uninstalling Python\/Anaconda on your Windows computer, Command Prompt may not open. When you run cmd.exe, it flashes on the screen and immediately quits. Also, running DISM and SFC (to repair corrupt system files), repairing Windows installation, and running a thorough malware scan may not fix the issue.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[7],"tags":[106,191,396,441],"class_list":["post-28839","post","type-post","status-publish","format-standard","hentry","category-windows","tag-command-prompt","tag-error-messages","tag-powershell","tag-registry"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":55748,"url":"https:\/\/www.winhelponline.com\/blog\/powershell-closes-machine-config-parser-error\/","url_meta":{"origin":28839,"position":0},"title":"PowerShell Closes Immediately When Launched; Machine.Config Parser Error","author":"Ramesh","date":"June 23, 2023","format":false,"excerpt":"When you run PowerShell.exe, the PowerShell window may open and close immediately before you can read the error message. Running PowerShell.exe from an existing Command Prompt window, or opening PowerShell via Windows Terminal may show the error message: The shell cannot be started. A failure occurred during initialization: The type\u2026","rel":"","context":"In &quot;Windows 10&quot;","block_context":{"text":"Windows 10","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/windows-10\/"},"img":{"alt_text":"machine.config fix file","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2023\/06\/machine.config_parser_error_fix_cmd.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2023\/06\/machine.config_parser_error_fix_cmd.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2023\/06\/machine.config_parser_error_fix_cmd.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2023\/06\/machine.config_parser_error_fix_cmd.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":20265,"url":"https:\/\/www.winhelponline.com\/blog\/error-0x80073cfa-uninstall-app-removal-failed\/","url_meta":{"origin":28839,"position":1},"title":"Fix for Error 0x80073CFA when Uninstalling an App in Windows 10","author":"Ramesh","date":"December 9, 2020","format":false,"excerpt":"When uninstalling a Store app in Windows 10, you may get the error 0x80073CFA. This happens whether you use the Apps & Features GUI or PowerShell command to remove the app. Many users have indicated that the error happens when uninstalling some game apps like Forza Motorsport, Forza Horizon, Asphalt:\u2026","rel":"","context":"In &quot;Utilities&quot;","block_context":{"text":"Utilities","link":"https:\/\/www.winhelponline.com\/blog\/category\/utilities\/"},"img":{"alt_text":"0x80073CFA store app remove using python script","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2020\/12\/0x80073cfa-remove-package-nonremovable-2.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2020\/12\/0x80073cfa-remove-package-nonremovable-2.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2020\/12\/0x80073cfa-remove-package-nonremovable-2.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2020\/12\/0x80073cfa-remove-package-nonremovable-2.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":78009,"url":"https:\/\/www.winhelponline.com\/blog\/0xc0000142-cmd-powershell-sfc-dism\/","url_meta":{"origin":28839,"position":2},"title":"Error 0xC0000142 Launching CMD, PowerShell, SFC, or DISM","author":"Ramesh","date":"March 2, 2025","format":false,"excerpt":"When you start PowerShell or Command Prompt, the error code 0xc0000142 may appear. Any console tool, such as sfc.exe or dism.exe may throw the same error. The application was unable to start correctly (0xc0000142). Click OK to close the application. SIMILAR: [Fix] Error 0xc0000017 when running DISM or SFC Cause\u2026","rel":"","context":"In &quot;Windows 10&quot;","block_context":{"text":"Windows 10","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/windows-10\/"},"img":{"alt_text":"0xc0000142 error when launching cmd.exe or powershell.","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2025\/03\/0xc0000142-cmd-powershell.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":4813,"url":"https:\/\/www.winhelponline.com\/blog\/cmd-here-windows-10-context-menu-add\/","url_meta":{"origin":28839,"position":3},"title":"Add &#8220;Open command window here&#8221; to Context Menu in Windows 10","author":"Ramesh","date":"December 13, 2016","format":false,"excerpt":"In the recent versions of Windows 10 (Creators Update and higher), the \"Open Command Prompt here\" context menu entry has been removed and is replaced by \"Open PowerShell window here\". Microsoft, in an effort to bring the best command line experiences to the forefront for all power users, has made\u2026","rel":"","context":"In &quot;Windows 10&quot;","block_context":{"text":"Windows 10","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/windows-10\/"},"img":{"alt_text":"cmdhere context menu icon","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/12\/cmdhere-context-menu.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":24381,"url":"https:\/\/www.winhelponline.com\/blog\/add-open-command-window-here-menu-windows-11\/","url_meta":{"origin":28839,"position":4},"title":"How to Add &#8220;Open command window here&#8221; in Windows 11","author":"Ramesh","date":"October 10, 2021","format":false,"excerpt":"In Windows 11, the context menu \"Open Command window here\" doesn't exist by default. Instead, you'll see the \"Open in Windows Terminal\" and \"Open PowerShell window here\" (when you press Shift + right-click) options in the folder context menu. This article tells you how to add \"Open Command window here\"\u2026","rel":"","context":"In &quot;Windows 11&quot;","block_context":{"text":"Windows 11","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/windows-11\/"},"img":{"alt_text":"windows terminal option in win+x start context menu","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2021\/10\/win-x-terminal-powershell-comd.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":53640,"url":"https:\/\/www.winhelponline.com\/blog\/set-default-terminal-windows-11\/","url_meta":{"origin":28839,"position":5},"title":"How to Set the Default Terminal Application in Windows 11","author":"Ramesh","date":"June 14, 2023","format":false,"excerpt":"The Windows Terminal becomes the default terminal. This means, all command line applications, such as Command Prompt and PowerShell, will open in Windows Terminal automatically. This article tells you how to change the default terminal to Windows Console Host or revert to Windows Terminal as the default host. Set the\u2026","rel":"","context":"In &quot;Windows 11&quot;","block_context":{"text":"Windows 11","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/windows-11\/"},"img":{"alt_text":"command prompt legacy mode enable or disable","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2023\/06\/cmd-enable-disable-legacy-console.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/posts\/28839","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/comments?post=28839"}],"version-history":[{"count":0,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/posts\/28839\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/media?parent=28839"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/categories?post=28839"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/tags?post=28839"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}