I used to wonder what is the best way run DOS commands under command window without closing it immediately after run giving message that I forgot to enter any switch.
But then there was AutoHotKey...amazing! It is like panacea for Windows.
Following code opens command window with following additions:
a) If you are on a folder: changes the current folder of the command window to the folder in the explorer. Just like the so called PowerToy from MS.
#c::
WinGetText, text, A ; This is required to get the full path of the file ftom the address bar
StringSplit, word_array, text, `n ; Get the first string which is usually full path in the address bar
t = %word_array1% ; Take the first element from the array
StringReplace, t, t, `r, , all ; Just in case
clipboard_prev = %clipboard%
clipboard =
Send, {F2}
Send, ^c
Send, {Esc}
cb = %clipboard%
clipboard = %clipboard_prev%
IfInString t, \
{
IfInString cb, .
{
Run, cmd /K cd "%t%"
WinWaitActive, cmd.exe,,1
Send, %cb%
}
else
Run, cmd /K cd "%t%"
}
else
Run, cmd /K cd "C:\"
returnAlthough there is no harm in running this anytime you wish but, this is meant to work in Windows Explorer only, as there are many unhandled cases. As you can see, it works only if you have address bar visible and also "Display full path in the address bar checked" option is checked (which I anyway keep checked).
Not quite sure if this is the only way to do what I wanted.
Any suggestion/feedback is welcome.




