0

I saw some other questions about this here, but still got nothing working for what I want.

I want to right click the empty space of a folder, and see a menu for executing a batch file for the current folder.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\treeFiles]
@="Execute treeFiles"
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\Directory\shell\treeFiles\command]
@="C:\treeFiles.bat \"%V\""
@="C:\\treeFiles.bat -d \"\"%V\"\""

With the above, I can only see the item when I right-click a folder (not the empty space), and the batch will execute relative to it's self path, not the current folder.

Any idea how to fix?

1 Answer 1

1

Use this instead:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\treeFiles]
@="&Execute treeFiles"
"Icon"="%SystemRoot%\\System32\\shell32.dll,71"

[HKEY_CLASSES_ROOT\Directory\Background\shell\treeFiles\command]
@="C:\\treeFiles.bat \"%V\""
Sign up to request clarification or add additional context in comments.

2 Comments

By the way, do you know why my "right-click on folder" version is executing from the batch file root dir, instead of the selected dir which I'm clicking on?
@TomBrito Yes, I do. It's because you've specified a NoWorkingDirectory string value in your REG file which starts the script with the default working directory of %SYSTEMROOT%\system32.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.