Disable file associations depending on number of arguments

  • Thread starter Francisco del Valle
  • Start date
F

Francisco del Valle

Hi.

I've created a program similar to Unzip. It takes command line arguments
like this:

unzip file1

I've added this Keys to Registry:

HKEY_CLASSES_ROOT\MY_FILE_TYPE\Shell\MYZIP = "Unzip file"
HKEY_CLASSES_ROOT\MY_FILE_TYPE\Shell\MYZIP\Command =
"[PROGRAM_PATH]\MyUnZip.exe" %1

My problem is: when I select more than one file to unzip, the program fails
(windows open a program for each file). How can I disable this file
associaton when the number of arguments is more than one?. I mean, I want
that "Unzip file" only appear when I right click only one file.


Sorry for my bad english.

Thank you.
 
M

Mark V

In said:
Hi.

I've created a program similar to Unzip. It takes command line
arguments like this:

unzip file1

I've added this Keys to Registry:

HKEY_CLASSES_ROOT\MY_FILE_TYPE\Shell\MYZIP = "Unzip file"
HKEY_CLASSES_ROOT\MY_FILE_TYPE\Shell\MYZIP\Command =
"[PROGRAM_PATH]\MyUnZip.exe" %1

My problem is: when I select more than one file to unzip, the
program fails (windows open a program for each file). How can I
disable this file associaton when the number of arguments is
more than one?. I mean, I want that "Unzip file" only appear
when I right click only one file.

Generally your application should parse passed arguments and if
designed to do so, utilize only the first one.

...\myzip.exe "%*"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top