Respostas (11)
Solução encontrada!
Utilisez ce raccourci clavier : Shift + Menu, W, Enter
Shift + Menu (alternativement, Shift + F10), (ouvre le menu étendu du clic droit dans le dossier en cours)
W (sélectionne “Open Command Window Here”),
Enter (active la sélection ; obligatoire puisque “New” peut également être sélectionné avec W)
La touche Menu fait référence à la touche spéciale introduite par Microsoft, généralement à droite de la touche Win de droite.
Ce raccourci est disponible sur une installation par défaut de Windows (7) sans logiciel tiers.
La manière AHK. Il vous suffit d'appuyer sur Win + C (ou sur ce que vous voulez définir comme.) :
SetTitleMatchMode RegEx
return
; Stuff to do when Windows Explorer is open
;
#IfWinActive ahk_class ExploreWClass|CabinetWClass
; create new text file
;
#t::Send !fwt
; open 'cmd' in the current directory
;
#c::
OpenCmdInCurrent()
return
#IfWinActive
; Opens the command shell 'cmd' in the directory browsed in Explorer.
; Note: expecting to be run when the active window is Explorer.
;
OpenCmdInCurrent()
{
; This is required to get the full path of the file from the address bar
WinGetText, full_path, A
; Split on newline (`n)
StringSplit, word_array, full_path, `n
; Find and take the element from the array that contains address
Loop, %word_array0%
{
IfInString, word_array%A_Index%, Address
{
full_path := word_array%A_Index%
break
}
}
; strip to bare address
full_path := RegExReplace(full_path, "^Address: ", "")
; Just in case - remove all carriage returns (`r)
StringReplace, full_path, full_path, `r, , all
IfInString full_path, \
{
Run, cmd /K cd /D "%full_path%"
}
else
{
Run, cmd /K cd /D "C:\ "
}
}
En bonus, le script ci-dessus crée également un nouveau fichier texte avec ce raccourci : Win + T
Crédit à : Eli Bendersky
Appuyez sur Alt+D, tapez cmd et appuyez sur Entrée. Pour plus de détails, voir le billet de blog ici .
la manière native de faire quelque chose de similaire dans Windows7 est de maintenir la touche shift enfoncée tout en appuyant sur le bouton droit de la souris sur le dossier auquel vous souhaitez “commander” et un nouvel élément de menu apparaîtra dans votre menu contextuel vous offrant exactement cela : “Si vous voulez une action purement clavier, vous devez faire ceci :
- ouvrir
regedit - aller à
HKEY_CLASSES_ROOT\Directory\shell\cmdet renommer la toucheExtendedenExtended_save - aller à
HKEY_CLASSES_ROOT\Drive\shell\cmdet renommer leExtended key toExtended_save`
this adds the "open command window here” entry to the context menu permanently. you can trigger this entry by pressing:
- alt
- let go, context menu opens
- press the “underscored” character of the “open command window here” entry or go down with your cursor keys and hit enter
the name of the menu entry is labled according to the language of your OS.
an alternative route is to do this:
- open the folder you want in the command prompt via the explorer
- f4
- ctrla
- ctrlc
- winr
cmd /k cdctrlventer
which grabs the current path from the address bar of explorer and executes cmd /k cd PATH. Avec les touches automatiques, vous pouvez faire la même chose, mais je ne connais pas les touches automatiques.
From how-to-open-cmd-in-current-folder-by-shortcut-windows-10
Si vous utilisez Windows 8/10, il existe un moyen plus rapide et original :
Alt + F, P
Il suffit d'appuyer sur trois touches et de taper deux fois, sans l'aide d'un autre programme.
Depuis la dernière mise à jour de Windows 10, la méthode Shift + Menu, W de la réponse du Leftium ne fonctionne plus. Cependant, une petite modification peut présenter un contournement, bien qu'avec quelques touches supplémentaires.
Le problème est que l'invite de commande n'est plus disponible dans le menu étendu du clic droit. A la place, vous avez maintenant Windows Powershell.
Shift + Menu, S ouvre Windows Powershell dans le dossier cible. Une fois dans Windows Powershell, tapez cmd puis appuyez sur Entrée.
Cela vous donnera accès à l'invite de commande dans Windows Powershell.
P.S.
La méthode de Ashwin Nanjappa de Ctrl + L, tapez cmd puis appuyez sur Entrée fonctionne. Cependant, elle n'est élégante que si vous n'avez pas l'intention de revenir à la fenêtre de l'explorateur Windows pour continuer à naviguer entre les répertoires. Malheureusement, cette méthode éloigne votre curseur dans l'explorateur Windows de la fenêtre principale et nécessite un certain nombre de touches de tabulation pour le ramener à l'endroit où vous pouvez naviguer dans les dossiers à l'aide des touches fléchées. Cela peut être frustrant car il y a peu de confirmation visuelle lorsque vous appuyez sur ces touches de tabulation.
Alors que Windows Powershell fonctionne de manière identique à l'invite de commande, j'ai rencontré au moins un cas où Windows Powershell a mal lu mes @tags (lorsque je générais des javadocs) et n'a pas produit le résultat souhaité. En tapant cmd puis Enter dans Windows Powershell, vous pouvez utiliser l'invite de commande à la place, ce qui permet de surmonter ces problèmes.
Script AutoHotKey pour ouvrir l'invite de commande en utilisant @Ashwin’s method
Ouvrir la console Powershell en utilisant Win P
#P::
{
Send !D
Send powershell
Send {Enter}
return
}
Ouvrir l'invite de commande en utilisant Win C
#C::
{
Send !D
Send CMD
Send {Enter}
return
}
Un script AHK plus simple que celui de la question sélectionnée
#c::cmdHere()
cmdHere() {
If WinActive("ahk_class CabinetWClass") || WinActive("ahk_class ExploreWClass") {
WinHWND := WinActive()
For win in ComObjCreate("Shell.Application").Windows
If (win.HWND = WinHWND) {
dir := SubStr(win.LocationURL, 9) ; remove "file:///"
dir := RegExReplace(dir, "%20", " ")
Break
}
}
Run, cmd, % dir ? dir : A_Desktop
}
source d'ici : https://autohotkey.com/boards/viewtopic.php?t=5796
Pour AHK, voici ma reliure :
#c::
Run, C:\Windows\system32\cmd.exe
return
Ceci n'ouvre pas le dossier actuel, mais c'est pratique.