回答 (11)
解決策が見つかりました
このキーボードショートカットを使用します。Shift + Menu, W, Enter
Shift + メニュー (代わりに、Shift + F10)、(現在のフォルダで拡張右クリックメニューを開きます)
W(「ここにコマンドウィンドウを開く」を選択)、
Enter (選択を有効にします。"新規 “もWで選択可能なので必要です)
メニューキーはマイクロソフトが導入した特別なキーを指し、通常は右Winキーの右にあります。
このショートカットはサードパーティソフトウェアなしでWindows(7)のデフォルトインストールで利用可能です。
AHKの方法。あなたはちょうど勝利 + C (またはあなたがそれをとして定義したいと思うものは何でも)を押す必要があります:
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:\ "
}
}
ボーナスとして、上のスクリプトはまたこのショートカットが付いている新しいテキストファイルを作成します。Win + T
Credit to. Eli Bendersky ](https://stackoverflow.com/questions/98597/best-autohotkey-macros/100648#100648)
Alt+Dを押して、cmdと入力してEnterキーを押します。詳細はブログ記事こちらを参照してください。
Windows7で同様のことをするネイティブな方法は、シフトを押しながら右マウスを “コマンドプロンプト "したいフォルダの上に押して、新しいメニュー項目がコンテキストメニューに表示され、まさにそれを提供しています。”
もし純粋なキーボード操作をしたい場合は、次のようにしなければなりません:
- open
regedit - go to
HKEY_CLASSES_ROOT\Directory\shell\cmdand rename toExtendedkey toExtended_save - go to
HKEY_CLASSES_ROOT\Drive\shell\cmdand rename toExtended 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. autohotkeysでも同じことができますが、私はautohotkeysを知りません。
from how-to-open-cmd-in-current-folder-by-shortcut-windows-10
Windows 8/10をお使いの場合、より速く、よりオリジナルな方法があります: Alt + F, P
他のプログラムの助けを借りずに、3つのキーを押して2回入力するだけです。
最新の Windows 10 アップデートでは、Leftium の回答の Shift + Menu, W メソッドは動作しなくなりました。しかし、ちょっとした修正で、もう少しキーストロークが必要ですが、回避策を提示することができます。
問題は、Command Prompt が Extended Right-Click Menu で利用できなくなったことです。その代わりに Windows Powershell があります。
Shift + Menu, S でターゲットフォルダ内の Windows Powershell を開きます。Windows Powershellに入ったら、cmdと入力してEnterキーを押してください。しかし、それはあなたがディレクトリ間で移動を続けるためにWindowsエクスプローラのウィンドウに戻るつもりがない場合にのみ、エレガントです。残念なことに、この方法ではWindowsエクスプローラのカーソルがメインウィンドウから離れてしまい、矢印キーを使ってフォルダを移動できる場所に戻すには、Tabキーを何回も押す必要があります。
Windows Powershell はほとんどの点で Command Prompt と同じように動作しますが、私は Windows Powershell が (javadocs を生成しているときに) 私の @tags を誤って読み違えてしまい、希望する結果が得られないというケースに少なくとも 1 回は遭遇しました。Windows Powershell 内で cmd と入力してから Enter を押すと、代わりにコマンドプロンプトを使うことができ、このような問題を解決することができます。
AutoHotKeyスクリプトを使用してコマンドプロンプトを開く @Ashwinの方法
Win Pを使用してPowershellコンソールを開く
#P::
{
Send !D
Send powershell
Send {Enter}
return
}
Win Cを使用してコマンドプロンプトを開く
#C::
{
Send !D
Send CMD
Send {Enter}
return
}
選択問題のものよりも簡単なAHKスクリプト
#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 from here : https://autohotkey.com/boards/viewtopic.php?t=5796
AHKの場合は、以下のようなバインディングになっています。
