Unable to Open Command Prompt Here

Discussion in 'Windows 10' started by DeathStalker77, Mar 31, 2020.

  1. DeathStalker77

    DeathStalker77 MDL Addicted

    Nov 8, 2009
    580
    43
    30
    #1 DeathStalker77, Mar 31, 2020
    Last edited: Mar 31, 2020
    As either normal or As Admin, when I use Shift+Rt Click it opens and immediately closes.

    I have tried running some scripts that are supposed to add registry entries :

    [HKEY_CLASSES_ROOT\Directory\shell\OpenCmdHereAsAdmin]
    @="Open command window here as administrator"
    "Extended"=-
    "Icon"="imageres.dll,-5324"

    [HKEY_CLASSES_ROOT\Directory\shell\OpenCmdHereAsAdmin\command]
    @="cmd /c echo|set/p=\"%L\"|powershell -NoP -W 1 -NonI -NoL \"SaPs 'cmd' -Args '/c \"\"\"cd /d',$([char]34+$Input+[char]34),'^&^& start /b cmd.exe\"\"\"' -Verb RunAs\""

    [HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHereAsAdmin]
    @="Open command window here as administrator"
    "Extended"=-
    "Icon"="imageres.dll,-5324"

    [HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHereAsAdmin\command]
    @="cmd /c echo|set/p=\"%V\"|powershell -NoP -W 1 -NonI -NoL \"SaPs 'cmd' -Args '/c \"\"\"cd /d',$([char]34+$Input+[char]34),'^&^& start /b cmd.exe\"\"\"' -Verb RunAs\""

    [HKEY_CLASSES_ROOT\Drive\shell\OpenCmdHereAsAdmin]
    @="Open command window here as administrator"
    "Extended"=-
    "Icon"="imageres.dll,-5324"

    [HKEY_CLASSES_ROOT\Drive\shell\OpenCmdHereAsAdmin\command]
    @="cmd /c echo|set/p=\"%L\"|powershell -NoP -W 1 -NonI -NoL \"SaPs 'cmd' -Args '/c \"\"\"cd /d',$([char]34+$Input+[char]34),'^&^& start /b cmd.exe\"\"\"' -Verb RunAs\""

    [HKEY_CLASSES_ROOT\LibraryFolder\background\shell\OpenCmdHereAsAdmin]
    @="Open command window here as administrator"
    "Extended"=-
    "Icon"="imageres.dll,-5324"

    [HKEY_CLASSES_ROOT\LibraryFolder\background\shell\OpenCmdHereAsAdmin\command]
    @="cmd /c echo|set/p=\"%V\"|powershell -NoP -W 1 -NonI -NoL \"SaPs 'cmd' -Args '/c \"\"\"cd /d',$([char]34+$Input+[char]34),'^&^& start /b cmd.exe\"\"\"' -Verb RunAs\""

    and just

    [HKEY_CLASSES_ROOT\Directory\shell\OpenCmdHereAsAdmin]
    @="Open command window here as administrator"
    "Extended"=-
    "Icon"="imageres.dll,-5324"

    [HKEY_CLASSES_ROOT\Directory\shell\OpenCmdHereAsAdmin\command]
    @="cmd /c echo|set/p=\"%L\"|powershell -NoP -W 1 -NonI -NoL \"SaPs 'cmd' -Args '/c \"\"\"cd /d',$([char]34+$Input+[char]34),'^&^& start /b cmd.exe\"\"\"' -Verb RunAs\""

    [HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHereAsAdmin]
    @="Open command window here as administrator"
    "Extended"=-
    "Icon"="imageres.dll,-5324"

    [HKEY_CLASSES_ROOT\Directory\Background\shell\OpenCmdHereAsAdmin\command]
    @="cmd /c echo|set/p=\"%V\"|powershell -NoP -W 1 -NonI -NoL \"SaPs 'cmd' -Args '/c \"\"\"cd /d',$([char]34+$Input+[char]34),'^&^& start /b cmd.exe\"\"\"' -Verb RunAs\""



    [HKEY_CLASSES_ROOT\Drive\shell\OpenCmdHereAsAdmin]
    @="Open command window here as administrator"
    "Extended"=-
    "Icon"="imageres.dll,-5324"

    [HKEY_CLASSES_ROOT\Drive\shell\OpenCmdHereAsAdmin\command]
    @="cmd /c echo|set/p=\"%L\"|powershell -NoP -W 1 -NonI -NoL \"SaPs 'cmd' -Args '/c \"\"\"cd /d',$([char]34+$Input+[char]34),'^&^& start /b cmd.exe\"\"\"' -Verb RunAs\""



    [HKEY_CLASSES_ROOT\LibraryFolder\background\shell\OpenCmdHereAsAdmin]
    @="Open command window here as administrator"
    "Extended"=-
    "Icon"="imageres.dll,-5324"

    [HKEY_CLASSES_ROOT\LibraryFolder\background\shell\OpenCmdHereAsAdmin\command]
    @="cmd /c echo|set/p=\"%V\"|powershell -NoP -W 1 -NonI -NoL \"SaPs 'cmd' -Args '/c \"\"\"cd /d',$([char]34+$Input+[char]34),'^&^& start /b cmd.exe\"\"\"' -Verb RunAs\""

    But nothing changes and nothing si added to the registry under:

    [HKEY_CLASSES_ROOT\Drive\shell\...]

    This is VERY frustrating :(

    Any ideas?

    Also I should add that when ever I open the Command Prompt (or PowerShell) it defaults to System32 and does not recognize a command from anywhere else on the system - even though it is in the Environmental settings :(

    Thanks!
     
  2. Windows_Addict

    Windows_Addict MDL Expert

    Jul 19, 2018
    1,365
    4,300
    60
    #2 Windows_Addict, Mar 31, 2020
    Last edited: Mar 31, 2020
    I got these registry keys from somewhere, don't remember exactly. Works fine. :)

    Edit - It's from this post.

    Capture.PNG
     

    Attached Files:

    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. nodnar

    nodnar MDL Expert

    Oct 15, 2011
    1,338
    1,069
    60
    i dunno if you got your prompt back, but i would just call cmd.exe from a batch file. like this;
    [it should be in your system directory.]
    @echo off
    @call cmd.exe
    @pause
    @echo this should give you some time to use your prompt.
    @cls
    @exit

    copy/paste that in notepad, and save it as cmd.bat on your desktop.
    if it gives an error like cannot find cmd.exe,
    copy paste the file to your rootdirectory.
    good luck, and please let us know if it worked.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. DeathStalker77

    DeathStalker77 MDL Addicted

    Nov 8, 2009
    580
    43
    30
    Ah! That seems to have added it (to the very bottom of the rt click list).

    However, it still doesn't recognize any exe being run in the directory -
    ...
    iperf-3.1.3-win64>iperf3.exe -s -p 32118
    'iperf3.exe' is not recognized as an internal or external command,
    operable program or batch file.

    This same message occurs with any exe in any directory :(
     
  5. DeathStalker77

    DeathStalker77 MDL Addicted

    Nov 8, 2009
    580
    43
    30
    Adding a batch file does not do anything if I am trying to rt click and run here (even with Shift+Rt Click).
     
  6. Windows_Addict

    Windows_Addict MDL Expert

    Jul 19, 2018
    1,365
    4,300
    60
    This could happen due to special characters in the file path.
    Code:
    ` ~ ; ' , ! @ % ^ & ( ) [ ] { } + =
    Try with a simple path or root directory.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. DeathStalker77

    DeathStalker77 MDL Addicted

    Nov 8, 2009
    580
    43
    30
    No, no special characters in the path :(
     
  8. nodnar

    nodnar MDL Expert

    Oct 15, 2011
    1,338
    1,069
    60
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. kaljukass

    kaljukass MDL Guru

    Nov 26, 2012
    3,451
    1,345
    120
    Please tell me if without any scripts cmd.exe will open as it should and will it also open if use "Run as administrator"?
    Then if it opens and everything works as it should, then it makes sense to start looking for the cause of the problem elsewhere.
    In addition, do all other programs open normally and also do all taskbar popup menus open normally? (it means Notifications, Calendar, language, volume, network, battery, startmenu etc).
    If they also won't open immidiately or closes immidiately after have opened, can search for script and right-click menu problems.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. nodnar

    nodnar MDL Expert

    Oct 15, 2011
    1,338
    1,069
    60
    hm. it seems it was an old one. the thread that i found was created in january 2017.
    they suggested all kinds of bs then,which did not seem to work.
    they have locked that thread since then. but no clue of a solution.
    [they must have solved it or the whole w10 world would be hysterical by now if they had not.]
    but i still have got no idea how they did it. always refused to look at w 10 problems.
    [maybe @Enthousiast knows..]
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  11. Enthousiast

    Enthousiast MDL Tester

    Oct 30, 2009
    49,768
    103,925
    450
    The MRP project covers this and most of the other tweaks mentioned lately.
     
  12. DeathStalker77

    DeathStalker77 MDL Addicted

    Nov 8, 2009
    580
    43
    30
    I'm sorry, but I'm unable to find the posts that would cover this in the MDL Project forum. Could you possibly provide some links?

    Thank you!
     
  13. nodnar

    nodnar MDL Expert

    Oct 15, 2011
    1,338
    1,069
    60
    #13 nodnar, Apr 1, 2020
    Last edited: Apr 1, 2020
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  14. Windows_Addict

    Windows_Addict MDL Expert

    Jul 19, 2018
    1,365
    4,300
    60
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  15. DeathStalker77

    DeathStalker77 MDL Addicted

    Nov 8, 2009
    580
    43
    30
    Yes, everything you listed works correctly, it is only the open Command Prompt here that doesn't, and when it does (for PowerShell) -if I switch the option between the two) it still does not recognize any command on an exe.
     
  16. kaljukass

    kaljukass MDL Guru

    Nov 26, 2012
    3,451
    1,345
    120
    If .exe files work in the normal way, (ie by double clicking) it's hard to guess what the problem is.
    I haven't checked or tested the script in your first post, but what's in that post is correct and works great. Use this.
    Code:
    https://forums.mydigitallife.net/threads/how-to-use-command-prompt-instead-of-powershell-when-i-press-shift-right-click.73800/page-2#post-1334145
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  17. AveYo

    AveYo MDL Expert

    Feb 10, 2009
    1,836
    5,730
    60
    To me this screams bad configuration / f**ked up account permissions similar to this other "exe-not-working" topic: https://forums.mydigitallife.net/threads/1709-to-1803-fails.81098
    Make a new admin account and see if the issue persist
    If issue persists, the whole windows install is compromised, in need of a repair.
    If not, try to repair the current one's permissions (instructions in the above topic posted by me).
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  18. DeathStalker77

    DeathStalker77 MDL Addicted

    Nov 8, 2009
    580
    43
    30
    K. I might get around to reinstalling at some point in the future. For now it's just an annoyance.