ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Unfinished Requests

IDEA: Get current directory

<< < (2/4) > >>

Hawkbane:
Skrommel, thanx for the code and the suggestion.  My question is, how is this different than 'Open Command Prompt here' other than the hot key?  You still have to have the folder selected, correct?  That really isn't what I am looking for.  In Linux, if you have Konquerer (KDE version of Explorer/IE) open, then hit PF4, then the terminal shell opens in that current directory, no selection of the current dir is necessary.  I assume that it just "pings" the tree and the return directory is passed to the terminal as a variable.

Everything that I have seen with Windows shows me that I have to physically select the folder that I want to open to pass to the cmd.  A.K.A., I need to back up to the parent dir of the folder that I want, highlight the folder, then apply whichever means I desire to open the cmd.  I don't think that this should have to be.  From my thinking, there HAS to be a way in which for this to work.  It just needs to be figured out :) .  Do I make what I am looking for clear?

mouser:
a reasonable compromise might be to modify it so that you can select any FILE and hit the hotkey to bring up a dos command box in the directory where the file lives - you'd still have to select something, but you wouldnt have to go up to the parent folder first so it would save some time.

skrommel:
 :) Again, this is for Explorer:

GetCurDir opens the current dir of Explorer in a command prompt when pressing Ctrl-D. No selection nessesary, and the window can be in the background.

To use it: Turn on the setting to show the entire path in the title bar of Explorer. I haven't got an english version, but it's something like Tools-Folder options-Show complete path in titlebar.

Edit: Updated to v1.0: Added detection of ordinary Explorer windows, the kind without the treeview. The other kind has priority, though.

Also, some of the pathless folders like My Computer wont show up.

Download and install AutoHotKey from www.autohotkey.com. Save the script as OpenOther.ahk and doubleclick to run.

Skrommel



--- ---;GetCurDir.ahk v1.0
;Open the current dir of Explorer in a command prompt by pressing Ctrl-D
;Skrommel @2005

^d::
SetKeyDelay,0
IfWinExist,ahk_class ExploreWClass
  WinGetTitle,title,ahk_class ExploreWClass
Else
  WinGetTitle,title,ahk_class CabinetWClass
Run,cmd /k cd %title%
SplitPath,title,,,,,drive
WinActivate,ahk_class ConsoleWindowClass
WinWaitActive,ahk_class ConsoleWindowClass
Send,%drive%{Enter}cls{Enter}

mouser:
awesome -
skrommel, may i make a suggestion: adding a version # to the comments at the top of your scripts would make it easier for people to make sure they always had latest version.

murple:
Skrommel,

I realise this thread is ancient but I've been roaming the forums and this caught my eye. I read through your code and couldn't figure out why you had to send text to the command prompt. It's odd you can't just do run, cmd f:\anydrive\anyfolder. Anyhow, I found a nice article at microsoft.com which says: "You can use multiple commands separated by the command separator && for string, but you must enclose them in quotation marks (for example, "command&&command&&command")." which means we can use:


--- ---SplitPath,title,,,,,drive
run, cmd /k "%drive%&&cd %title%"[/

Full script:

--- ---;GetCurDir.ahk v1.0
;Open the current dir of Explorer in a command prompt by pressing Ctrl-D
;Skrommel @2005

^d::
SetKeyDelay,0
IfWinExist,ahk_class ExploreWClass
  WinGetTitle,title,ahk_class ExploreWClass
Else
  WinGetTitle,title,ahk_class CabinetWClass
SplitPath,title,,,,,drive
run, cmd /k "%drive%&&cd %title%"
See also this great utility: The Command Prompt Explorer Bar

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version