Thursday, December 11, 2014

Make batch files open in the right directory in Windows

One thing I've always found annoying when working with batch files is that when I double-click one, it starts in my home directory instead of the directory that contains the batch file. I decided to look for a way to fix this, so I started experimenting in the registry a bit, and came across a solution. All you need to do is change the "command" entry for .bat and .cmd files from ""%1" %*" to "cmd /c cd "%1\.." & "%1" %*". Sound complicated? Just download the file below and open it, making sure to say Yes to any warnings.

Here's the file you need to fix the issue I described.

Use this one to go back to the old behavior if you change your mind.

1 comment:

  1. If you wish for to obtain a good deal from this article then you have to apply these techniques to your won weblog.

    ReplyDelete