views:

818

answers:

9

I've had this problem for ages, and it's SO ANNOYING.

Suppose I want to run mysqldump.exe... here's my process: Start->run, type "cmd" ... dir into directory after directory until I finally get to c:/program files/mysql/bin/then I can FINALLY call "mysqldump.exe"

I don't mind using Windows Explorer to get to c:/program files/mysql/bin, but then I can't freaking open up any of the .exe files in a shell, and I can't open up shell with the directory being that one.

How can I do this?

+1  A: 

here's my process: Start->run, type "cmd" ... dir into directory after directory until I finally get to c:/program files/mysql/bin/ then I can FINALLY call "mysqldump.exe"

Why not just the following?

c:
cd "c:/program files/mysql/bin"
mysqldump.exe

Better yet, put this in a batch file and execute it.

You can also create a shortcut for cmd.exe and set the "Start in" directory to "c:/program files/mysql/bin".

Zach Scrivena
+6  A: 

Microsoft released a powertoy for Windows XP called Open Command Prompt Here. If you're using Vista, all you need to do is hold shift and right-click.

Samir Talwar
+1  A: 

You can download an add-in so that you can right click on the folder and open a command prompt. Saves a lot of time and you say you dont mind navigating to the location.

http://download.microsoft.com/download/whistler/Install/2/WXP/EN-US/CmdHerePowertoySetup.exe

RM
A: 

Just use the explorer to navigate to the bin or any directory. then enter cmd at the address bar und hit return. the command line with start at this location.

Mouk
+1  A: 

A nice little trick is that the icon in the adress bar of explorer could be dragged to a command line window and it insert the full path at your current cursor position.

It doesn't work in vista but if you SHIFT-RightClick on a folder you have an "Open Command Windows Here" option that appears.

Under xp you could have it by saving this as a .reg and executing it :

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\cmd]
@="Open Command Prompt Here"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\cmd\command]
@="cmd.exe /k pushd %L"
VirtualBlackFox
A: 

You can do it with python: If you don't have activepython already, download from ActiveState's Website. Next, run PythonWin and create a new script. Write the following:

from subprocess import *
Call("c://program files//mysql//bin//mysqldump.exe")

Save the script somewhere. When you want to run it, just doubleclick. There are easier ways if you like writing batch files, but Python is more succinct than even windows for this case.

jle
How is that different from simply making a shortcut to the program? Seems like severe overkill to me.
Rob Kennedy
overkill is still a kill ;)
jle
+6  A: 

This is what I do for those type of commands:

Drag a copy of the "Command Prompt" shortcut onto your desktop.

Open the properties of the shortcut.

Change the Target: field to: %SystemRoot%\system32\cmd.exe /k mysqldump.exe

Change the Start in: field to: c:/program files/mysql/bin/

Hit Ok, then rename the short cut from "Command Prompt" to "Mysqldump".

Then just double click the icon whenever you need that command. The "/k" option for cmd.exe leaves the window open.

Ron

Ron Savage
A: 

Just put c:/program files/mysql/bin/ into your path...

Then you can run mysqldump.exe directly without even opening a cmd prompt by typing it into " Start > Run "

Alterlife
A: 

I was using the MS PowerToy for a while but moved on to the open source Open Command Prompt Shell Extension because of the key feature:

(copied verbatim from the website)

The ability to open a command prompt in the directory that you are currently in by right-clicking on any empty screen space in the directory. This eliminates the need to navigate up a level in order to open a command prompt in the current directory.

Having to actually click on a folder to open the command prompt using the MS tool was a annoyance for me... especially since I always need to run command line tools on my current directory at the time.

jkchong
You can right-click the Explorer window icon to get the current folder's context menu. No need for a full-blown shell extension.
Rob Kennedy