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?
Answer
I have tried on Windows XP SP3 with this .reg key. Don't have Windows 7 at the moment to test it properly but it should be almost the same.
- Open notepad and paste the code from below.
- Edit as per your need.
- Save as MyScript1.reg
- Double click to import in registry.
- Test by Right click on any directory in Explorer
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\MyScript1]
@="Execute MyScript1"
[HKEY_CLASSES_ROOT\Directory\shell\MyScript1\command]
@="\"C:\\MyScriptsDirectory\\MyScript1Directory\\MyScript1.bat\" \"%1\""
No comments:
Post a Comment