0

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 ?

woliveirajr
  • 4,170
  • 23
  • 32
Jamin Grey
  • 374
  • 1
  • 4
  • 12
  • This question would be better suited for [so]. – kinokijuf Jun 06 '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 06 '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](http://superuser.com/questions/136838/what-is-the-list-of-special-variables-available-when-writing-a-shell-command-for) – Karan Jun 06 '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 06 '13 at 22:29

1 Answers1

1

Use %V instead of %1.

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

kinokijuf
  • 8,175
  • 9
  • 54
  • 97
  • 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 06 '13 at 22:32
  • Hmm, [this answer](http://superuser.com/a/181668/199893) (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 06 '13 at 22:38