web-dev-qa-db-fra.com

Comment remplacer "Ouvrir avec Powershell" par "Ouvrir avec une invite de commande" lorsque je clique avec le bouton droit de la souris dans l'Explorateur?

Tout en maintenant la touche Maj enfoncée, un emplacement vide dans l'Explorateur affiche "Ouvrir avec PowerShell" au lieu de "Ouvrir avec l'invite de commande" depuis le Creators Update (2017-04). Comment puis-je obtenir l'ancien comportement où il montre "Ouvrir avec invite de commande" ?

J'ai essayé de modifier le paramètre "Afficher PowerShell au lieu d'invite de commande en cliquant avec le bouton droit sur le menu Démarrer ou en appuyant sur Windows + X" , mais cela n'a pas modifié le menu Maj + clic droit.

35
nelson2tm

Ouvrez regedit.exe, accédez à HKEY_CLASSES_ROOT\Directory\Shell\cmd, prenez possession de la clé , ajoutez les autorisations complètes à votre compte d'utilisateur et modifiez le nom du DWORD de HideBasedOnVelocityId à ShowBasedOnVelocityId en activez à nouveau l'entrée d'invite de commande .

 Enter image description here

Ou appliquez Andrew Richards Tweak pour avoir tous les deux montré (cmd et PowerShell, également avec l'entrée pour avoir la version elevate (exécutée en tant qu'administrateur)),

 Enter image description here

 Enter image description here

en important son fichier .reg (créez un nouveau fichier txt, collez le contenu et renommez l'extension en reg):

Windows Registry Editor Version 5.00

; Command Prompt

[HKEY_CLASSES_ROOT\Directory\Shell\01MenuCmd]
"MUIVerb"="Command Prompts"
"Icon"="cmd.exe"
"ExtendedSubCommandsKey"="Directory\\ContextMenus\\MenuCmd"

[HKEY_CLASSES_ROOT\Directory\background\Shell\01MenuCmd]
"MUIVerb"="Command Prompts"
"Icon"="cmd.exe"
"ExtendedSubCommandsKey"="Directory\\ContextMenus\\MenuCmd"

[HKEY_CLASSES_ROOT\Directory\ContextMenus\MenuCmd\Shell\open]
"MUIVerb"="Command Prompt"
"Icon"="cmd.exe"

[HKEY_CLASSES_ROOT\Directory\ContextMenus\MenuCmd\Shell\open\command]
@="cmd.exe /s /k pushd \"%V\""

[HKEY_CLASSES_ROOT\Directory\ContextMenus\MenuCmd\Shell\runas]
"MUIVerb"="Command Prompt Elevated"
"Icon"="cmd.exe"
"HasLUAShield"=""

[HKEY_CLASSES_ROOT\Directory\ContextMenus\MenuCmd\Shell\runas\command]
@="cmd.exe /s /k pushd \"%V\""


; PowerShell

[HKEY_CLASSES_ROOT\Directory\Shell\02MenuPowerShell]
"MUIVerb"="PowerShell Prompts"
"Icon"="powershell.exe"
"ExtendedSubCommandsKey"="Directory\\ContextMenus\\MenuPowerShell"

[HKEY_CLASSES_ROOT\Directory\background\Shell\02MenuPowerShell]
"MUIVerb"="PowerShell Prompts"
"Icon"="powershell.exe"
"ExtendedSubCommandsKey"="Directory\\ContextMenus\\MenuPowerShell"

[HKEY_CLASSES_ROOT\Directory\ContextMenus\MenuPowerShell\Shell\open]
"MUIVerb"="PowerShell"
"Icon"="powershell.exe"

[HKEY_CLASSES_ROOT\Directory\ContextMenus\MenuPowerShell\Shell\open\command]
@="powershell.exe -noexit -command Set-Location '%V'"

[HKEY_CLASSES_ROOT\Directory\ContextMenus\MenuPowerShell\Shell\runas]
"MUIVerb"="PowerShell Elevated"
"Icon"="powershell.exe"
"HasLUAShield"=""

[HKEY_CLASSES_ROOT\Directory\ContextMenus\MenuPowerShell\Shell\runas\command]
@="powershell.exe -noexit -command Set-Location '%V'"


; Ensure OS Entries are on the Extended Menu (Shift-Right Click)

[HKEY_CLASSES_ROOT\Directory\Shell\cmd]
"Extended"=""

[HKEY_CLASSES_ROOT\Directory\background\Shell\cmd]
"Extended"=""

[HKEY_CLASSES_ROOT\Directory\Shell\Powershell]
"Extended"=""

[HKEY_CLASSES_ROOT\Directory\background\Shell\Powershell]
"Extended"=""
40
magicandre1981

Ceci est extrêmement facile à accomplir

  • Dans la fenêtre Propriétés de la barre des tâches et du menu Démarrer , allez à l'onglet Navigation et décochez l'option Remplacer l'invite de commande avec Windows PowerShell .
  • Cliquez sur Appliquer pour que la modification soit prise en compte.

 enter image description here

Source: Remplacer l’invite de commande par PowerShell sur le menu Utilisateur expérimenté sous Windows 10

Source supplémentaire: Afficher une invite de commande ou PowerShell dans le menu Tâches de l'utilisateur puissant Windows + X sous Windows 10

 enter image description here

Source supplémentaire: Microsoft remplace l'invite de commande par PowerShell en tant que shell par défaut de Windows 10

7
Ramhound

Comme alternative rapide aux autres réponses, vous pouvez taper cmd dans la barre d'adresse d'Explorer pour ouvrir une commande Invite cd 'd dans le répertoire en cours. (Si vous êtes plus un habitué du clavier, vous pouvez utiliser le raccourci Ctrl + L pour faire le focus de la barre d’adresse, puis taper cmd.)

Cela fonctionne aussi pour powershell.

4
Raphael

Pour atteindre tous les emplacements où Windows a modifié cela, vous pouvez utiliser le fichier de registre suivant après en prenant possession de chaque clé en question.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\Shell\cmd]
"ShowBasedOnVelocityId"=dword:00639bc8
"HideBasedOnVelocityId"=-

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\Shell\Powershell]
"HideBasedOnVelocityId"=dword:00639bc8
"ShowBasedOnVelocityId"=-

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\Shell\cmd]
"ShowBasedOnVelocityId"=dword:00639bc8
"HideBasedOnVelocityId"=-

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\Shell\Powershell]
"HideBasedOnVelocityId"=dword:00639bc8
"ShowBasedOnVelocityId"=-

[HKEY_CLASSES_ROOT\Drive\Shell\cmd]
"ShowBasedOnVelocityId"=dword:00639bc8
"HideBasedOnVelocityId"=-

[HKEY_CLASSES_ROOT\Drive\Shell\Powershell]
"HideBasedOnVelocityId"=dword:00639bc8
"ShowBasedOnVelocityId"=-

Je voudrais simplement prendre possession des clés [HKCR\Directory] et [HKCR\Drive] de manière récursive et forcer l'héritage des autorisations.

 Registry Permissions and Ownership setting

1
palswim