views:

42

answers:

1

Hello,

I have this batch file which needs to do some stuff in a folder.

This is what i want:

-A shortcut when you right-click. (shell32 i think you should edit with the registry or so...? Can somebody say so?)

-If that shortcut is pressed, the batch is opened, and it locates the folder were was right-clicked. It should set this as a variable, %folder%.

Thanks.

+2  A: 

For the registry file:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Folder\shell\TEXT_TO_SHOW_IN_EXPLORER_CONTEXT]

[HKEY_CLASSES_ROOT\Folder\shell\TEXT_TO_SHOW_IN_EXPLORER_CONTEXT\command]
@="C:\\Path\\to\\batch.cmd \"%1\""

For the batch file:

set folder=%1
:: remove the " from the variable
set folder=%folder:"=%
echo %folder%

Comment out line 3 of the batch file if you want to keep "'s around the folder path.

Agent_9191
do i always need two slashes for the path to the cmd?
YourComputerHelpZ
it seemed to have failed. What i did: -Create new folder -create new command folder -Put the Default string to @="C:\\Path\\to\\batch.cmd \"%1\""
YourComputerHelpZ
so, it does not display the option in the right-click shell menu.
YourComputerHelpZ
you don't put the default string to the full thing. You set it to everything after the `=` sign. So just `"C:\\Path\\to\\batch.cmd \"%1\""`
Agent_9191
also, that only seems to work when you're click on a child folder in Explorer, not the folder that you're currently in.
Agent_9191
uhmmm, it does not work still. i exactly copied the reg stuff to a reg file, did some changes for my prefs, and then just double-clicked to get it. Logged off, logged on... Nothing. Tried in a lot of folders.
YourComputerHelpZ
and, i have Win7.
YourComputerHelpZ