18
12
I have a few programs that creates temp files or backup files or similar files that are not important.
For example, GVim for Windows by default creates a backup file in filename.txt~
.
I sometimes need to clean up a directory and remove all these files. I have made a simple .bat file for this. However, it is cumbersome to have to start up CMD, navigate to the folder, run the script. Especially since this is a script that I would like to run often on various folders. And I do not want to copy the script to multiple folders, as this would be a maintenance nightmare.
So, I was thinking, that the best solution would be to add a Right Click menu item that allows me to run the script. So that I can right click on a folder in Explorer and click Cleanup and then have my script run on this folder.
So my question is: How do I add a right click menu action that runs a custom batch script?
Here's an answer that talks about using the right-click Send To with files: http://stackoverflow.com/a/6854941/550712. That answer references this Microsoft article: http://support.microsoft.com/kb/310270.
– Mark Berry – 2014-07-02T17:31:01.0634I've edited your answer a bit. "Windows Registry Editor Version 5.00" is mandatory 'header' for .reg files. Otherwise Windows will refuse to inject the contents into registry. – extremko – 2012-07-04T10:48:18.227
+1 for pointing that one out. I totally forgot about that when c/p code. – Robert Schmidt – 2012-07-04T11:49:24.220
1I tried this. Now I can rightclick directyly on a folder, but it does not work if I rightclick inside a folder. Which is actually what I want. How to do that? – ervingsb – 2012-07-09T19:49:38.617
1That's a different question than the "So that I can right click on a folder in Explorer and click Cleanup and then have my script run on this folder." – Robert Schmidt – 2012-07-10T09:29:25.177
Yeah, that is why I clarified it. Sorry for being imprecise. I actually think of it as right clicking on the folder. It is just not the folder icon, but inside the folder. – ervingsb – 2012-07-12T08:40:06.757