1

I'm developing lot of small .esb services recently and I'm pretty tired of doing Shift+Right click to open cmdin current directory then typing mvn clean install.

What is the easiest way to run simple .bat file like:

cleanInstall.bat:

mvn clean install

on current directory when user will press a some simple shortcut e.g.: Win+C?

I have already read this thread: How can I open a command prompt in current folder with a keyboard shortcut? However I'm wondering do I need to use 3rd party software?

I'm using Windows 7 Polish version.

1 Answer 1

0
  1. Edit your batch file to cd /D "%1" before running mvn.

  2. In the answer to the question you linked, change the lines at the bottom so that Run, cmd /K cd /D "%full_path%" is replaced with Run, mvnCleanInstall.bat "%full_path%" (or whatever your batch file is called).

  3. Install autohotkey and the modified script per the comments to the answer.

  4. Enjoy!

(Edited-original answer below)

Other options: Classic Shell will let you create toolbar buttons in Explorer windows that run programs in the directory that window is showing.

Alternatively, you could create a shortcut to your bat file and name the shortcut "c" or something else short. Then you could type c in the address bar of an Explorer window and hit Enter to run the bat in the open folder. (Source)

3
  • 2nd option can be pretty nice workaround my problem. I will try it, HOWEVER in my version of windows non Alt+D nor Alt+E are focusing a address at address bar field. There is a uncomfortable F4 button which brings a cursor to the end of address, then i need to focus all with Ctrl+A then enter my command. Too many unnessery actions. Do you know maybe any other method to focus address bar? Aug 12, 2015 at 9:49
  • Naming .bat file like 'c' and putting into System32 works pretty well, however i need to find simple method to focus and clear address bar. Autohotkey option works aswell, but i will give a try to do it without other software. Aug 12, 2015 at 10:02
  • h30434.www3.hp.com/t5/Other-Desktop-PC-Questions/… suggests maybe some other program is grabbing alt+d or +e - maybe check that? Does the behaviour change depending on what keyboard input language you have selected?
    – cxw
    Aug 12, 2015 at 10:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .