Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to add an entry to the Windows folder background context menu. The following "command" value works:

"P:\Projects\GuardianBlade\OfStrangerFlames\Development\Project\Bin\MakeManifest.exe"

It successfully executes MakeManifest (a tiny development tool I'm working on for my real programming project).

However, I'd like to do this:

"P:\Projects\GuardianBlade\OfStrangerFlames\Development\Project\Bin\MakeManifest.exe" -root="%1"

But that doesn't work. Neither does this:

"P:\Projects\GuardianBlade\OfStrangerFlames\Development\Project\Bin\MakeManifest.exe" "-root=%1"

What I'm aiming for, is the program MakeManifest.exe to execute, and receive one command-line argument of the format:

-root="the/directory/right-clicked/in/"

I want the quotes around the directory path to be passed into MakeManifest preserved, and I'd like the entire thing (-root="the/directory/right-clicked/in/") to be one argument.

Failing that, I'd settle for -root passed in as one argument, and the/directory/path (without quotes but as one argument) passed in as the second argument. I can't get either to work.

All my attempts result in this error message: enter image description here

"This file does not have a program associated with it for performing this action. Please install a program or, if one is already installed, create an association in the Default Programs control panel."

...as if it were trying to identify what program to execute the entire command as a filepath.

Again, setting the command without any arguments works fine.

How should I do that ?

share|improve this question
    
This question would be better suited for Stack Overflow. –  kinokijuf Jun 6 '13 at 19:55
    
I was thinking that myself, but I wasn't sure. It's not directly programming related - it has to do with the format of shell commands on Windows. –  Jamin Grey Jun 6 '13 at 20:15
    
I think it's perfectly on-topic for SU, but a possible duplicate of What is the list of special variables available when writing a shell command for a context menu –  Karan Jun 6 '13 at 22:14
    
Yea, I found that answer after kinokijuf posted! I don't think the question is a duplicate, rather I think the answer to this question is the other topic. =P I'll add the link into kino's answer. –  Jamin Grey Jun 6 '13 at 22:29
add comment

1 Answer

up vote 0 down vote accepted

Use %V instead of %1.

For additional information on shell command variables like %V and %1, see this question.

share|improve this answer
    
So would %V or %W be the proper usage? It seems like %V just imitates %W in certain circumstances. So should I always just use %W then, if I want the directory? –  Jamin Grey Jun 6 '13 at 22:32
    
Hmm, this answer (in the linked thread) seems to imply %W actually behaves somewhat different than documented - at least in the observed results. But the poster didn't specify whether he right-clicked from within the folder, or merely on the folder icon, which might explain the deviation. –  Jamin Grey Jun 6 '13 at 22:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.