News for hackers. Stuff that matters.
Re:Quickly navigate your filesystem from the command line by skrebbel on Saturday August 17, 2013 @02:19PM (#6229835)
For Windows users I have a closely related shameless plug:

cdhere navigates your cmd.exe to wherever the current topmost Explorer window is pointed at.

It's not the same as the OP's trick, of course, but since you're voluntarily using Windows, I'm going to assume you "live" on the command line less than the average UNIX user, and more on GUI tools such as good old Explorer.

https://github.com/eteeselink/cdhere

Re:Quickly navigate your filesystem from the command line by Livven on Sunday August 18, 2013 @02:49AM (#6231917)
What many people don't seem to know is that the location bar in Explorer (at least on Windows 8) can act as a run dialog, and it supplies the launched program with the current folder as a parameter. So simply hit Ctrl+L and type "cmd" or "powershell" or whatever command from your PATH and hit enter.
Re:Quickly navigate your filesystem from the command line by WalterGR on Sunday August 18, 2013 @04:16AM (#6232079)
Amazing tip!

FYI: On Windows 7, you need to press Alt+D to get to the location bar. (I believe that's the case for XP as well.) Ctrl+L doesn't seem to do anything.

Re:Quickly navigate your filesystem from the command line by skrebbel on Sunday August 18, 2013 @05:33AM (#6232190)
Alt+D is my preferred shortcut anyway, since it has the same effect in e.g. fullscreen IE10. Consistency is nice.
Re:Quickly navigate your filesystem from the command line by WalterGR on Sunday August 18, 2013 @05:37AM (#6232199)
Totally. Also works in Chrome and Firefox.
Re:Quickly navigate your filesystem from the command line by TeMPOraL on Sunday August 18, 2013 @05:14PM (#6234262)
Thanks for the tip!

Neither Ctrl+L nor Alt+D work for me (Win7 Ultimate, 64bit), but even with clicking manually this is extremely useful for me.

Re:Quickly navigate your filesystem from the command line by tripzilch on Friday August 23, 2013 @05:54PM (#6266466)
I have been using F6 in my browsers, and it does seem to focus the address bar in File Explorer too. You need to press Enter first to be able to type commands though.
Re:Quickly navigate your filesystem from the command line by gizmo686 on Saturday August 17, 2013 @06:20PM (#6230565)
I'm not sure voluntary is necessarily true. I have had to use Windows several times because we were working with Windows only programs.

On a different note, back in UNIX land I found myself doing the opposite of what you described: opening the file explorer to the same directory as the command-line. Of course, there is not much to that trick other than choosing an explorer that opens to the working directory or a path provided as an arguement.

Re:Quickly navigate your filesystem from the command line by networked on Saturday August 17, 2013 @03:38PM (#6230101)
I like this.

On Windows you can also get a nice "browse for folder" dialog in batch files with Wfolder [1]. If you replace "cdwhere.exe" in your script (cdhere.cmd) with "wfolder.exe" [2] and put wfolder.exe in the same directory as cdhere.cmd then instead of going to the location open in the topmost Explorer window the "cdhere" command will ask you where to cd, starting at your current location (like so: http://i.imgur.com/3MCzD4b.png).

Edit: Wfolder comes with a script that's analogous to cdhere.cmd.

[1] http://www.horstmuc.de/wcon.htm

[2] I did it in http://pastebin.com/aq0FiKmz.

Re:Quickly navigate your filesystem from the command line by keyboardP on Saturday August 17, 2013 @02:50PM (#6229917)
You can hold shift and right-click in Explorer and select "Open Command Window Here" (at least in Win 7 and 8).
Re:Quickly navigate your filesystem from the command line by Too on Saturday August 17, 2013 @03:03PM (#6229957)
Or even faster: shift + context menu button, then W.
Re:Quickly navigate your filesystem from the command line by CrazedGeek on Saturday August 17, 2013 @03:35PM (#6230082)
About the same speed on Windows 8: File -> Open Command Prompt.
Re:Quickly navigate your filesystem from the command line by skrebbel on Sunday August 18, 2013 @03:07AM (#6231949)
Yep, this works fine, until you did it a 7th time and end up with a task bar full of unused console windows.
Re:Quickly navigate your filesystem from the command line by keyboardP on Sunday August 18, 2013 @12:12PM (#6233074)
If you want to reuse an existing cmd window you can type in "cd " then drag/drop the directory from any Explorer shell. You could also close the shell after finishing with it.

Not trying to take anything away from your script, it has a use-case, but just pointing out that there are alternate solutions for systems that don't have your script installed.

Re:Quickly navigate your filesystem from the command line by rntrg on Saturday August 17, 2013 @08:14PM (#6230945)
Another useful windows trick: to open a new file explorer window at the pwd of the command prompt, type 'explorer .'.
Re:Quickly navigate your filesystem from the command line by recursive on Sunday August 18, 2013 @03:35AM (#6232004)
or slightly shorter: 'start .'
Re:Quickly navigate your filesystem from the command line by mistercow on Saturday August 17, 2013 @04:51PM (#6230346)
I used to have a really hacky AppleScript to do the same thing in OS X. The crappy part was that launching the whole AppleScript runtime was really slow, but that was the only API I could find with getting that information from the Finder.
Re:Quickly navigate your filesystem from the command line by mrmaddog on Saturday August 17, 2013 @05:05PM (#6230372)
You can also drag any file or folder onto your terminal, which will paste the absolute filepath at your cursor point.
Re:Quickly navigate your filesystem from the command line by mistercow on Saturday August 17, 2013 @08:23PM (#6230974)
Yeah, but I rarely use the mouse when using either a file browser or the terminal, so switching to it is less convenient than a short terminal command.
Re:Quickly navigate your filesystem from the command line by ams6110 on Saturday August 17, 2013 @02:30PM (#6229873)
You could install cygwin and use the OP technique, though.
Re:Quickly navigate your filesystem from the command line by tripzilch on Friday August 23, 2013 @05:56PM (#6266474)
unfortunately cygwin takes a lot longer to start than cmd, so I use it only occasionally. are there any fixes for that maybe? :)