File extension association

  • Thread starter Thread starter Javier Ros
  • Start date Start date
J

Javier Ros

Where can i find the full path to executable to open a document?

I´m doing it: (it´s an example)

extension := ".pdf"
programName := HKEY_CLASSES_ROOT\(extension)\defaultValue
path := HKEY_CLASSES_ROOT\(programName)\shell\open\command\defaultValue

if this way not work then I do it:

extension := ".pdf"
programName :=
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExt
s\(extension)\Application
path :=
HKEY_CLASSES_ROOT\Applications\(programName)\shell\Open\command\defaultValue

if Application key don´t exists in
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExt
s\(extension) then
i get each value in
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExt
s\(extension)\OpenWithList and search it in
HKEY_CLASSES_ROOT\Applications\ to get HKEY_CLASSES_ROOT\Applications\(each
executable)\shell\Open\command\defaultValue

it´s the correct way?

I would like that it work in all windows operating systems.

I would like to do just like the windows explorer does.

Thanks in advance.

Javier Ros Moreno.
 
In said:
Where can i find the full path to executable to open a document?

I´m doing it: (it´s an example)

extension := ".pdf"
programName := HKEY_CLASSES_ROOT\(extension)\defaultValue
path :=
HKEY_CLASSES_ROOT\(programName)\shell\open\command\defaultValue

if this way not work then I do it:

extension := ".pdf"
programName :=
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explore
r\FileExt s\(extension)\Application
path :=
HKEY_CLASSES_ROOT\Applications\(programName)\shell\Open\command\def
aultValue

if Application key don´t exists in
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explore
r\FileExt s\(extension) then
i get each value in
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explore
r\FileExt s\(extension)\OpenWithList and search it in
HKEY_CLASSES_ROOT\Applications\ to get
HKEY_CLASSES_ROOT\Applications\(each
executable)\shell\Open\command\defaultValue

it´s the correct way?

That's a lot of work. :-)
I would like that it work in all windows operating systems.

Now that, I cannot recall. And "all" means Windows286 too?
I would like to do just like the windows explorer does.

Try these commands: ASSOC /? and FTYPE /?
which can both Read and Set values.

Example:
C:\TEMP>assoc .pdf
.pdf=AcroExch.Document

C:\TEMP>ftype AcroExch.Document
AcroExch.Document="C:\Program Files\Adobe\Acrobat 5.0\Reader\AcroRd32.exe" "%1"

of course yours might be different to some extent. That's all you
need in most cases to associate an extension with a filetype with
an executable from the commandline.

Much of your other stuff above is entirely un-needed or serves very
limited and even legacy purposes. Keep it simple.

That is not to say that much more cannot be done or that in
some situations things are more complex, but this
ext -> ftype -> executable "%1"
should serve.
 
In said:
Where can i find the full path to executable to open a document?

I´m doing it: (it´s an example)

extension := ".pdf"
programName := HKEY_CLASSES_ROOT\(extension)\defaultValue
path :=
HKEY_CLASSES_ROOT\(programName)\shell\open\command\defaultValue

if this way not work then I do it:

extension := ".pdf"
programName :=
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explore
r\FileExt s\(extension)\Application
path :=
HKEY_CLASSES_ROOT\Applications\(programName)\shell\Open\command\def
aultValue

if Application key don´t exists in
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explore
r\FileExt s\(extension) then
i get each value in
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explore
r\FileExt s\(extension)\OpenWithList and search it in
HKEY_CLASSES_ROOT\Applications\ to get
HKEY_CLASSES_ROOT\Applications\(each
executable)\shell\Open\command\defaultValue

it´s the correct way?

That's a lot of work. :-)
I would like that it work in all windows operating systems.

Now that, I cannot recall. And "all" means Windows286 too?
I would like to do just like the windows explorer does.

Try these commands: ASSOC /? and FTYPE /?
which can both Read and Set values.

Example:
C:\TEMP>assoc .pdf
.pdf=AcroExch.Document

C:\TEMP>ftype AcroExch.Document
AcroExch.Document="C:\Program Files\Adobe\Acrobat 5.0\Reader\AcroRd32.exe" "%1"

of course yours might be different to some extent. That's all you
need in most cases to associate an extension with a filetype with
an executable from the commandline.

Much of your other stuff above is entirely un-needed or serves very
limited and even legacy purposes. Keep it simple.

That is not to say that much more cannot be done or that in
some situations things are more complex, but this
ext -> ftype -> executable "%1"
should serve.
 
Back
Top