1

Suppose I am running cmd and I open an application by typing for example start document.pdf

I want to get the exact path of the executable that opens .pdf files

Of course I could search the entire system for the executable but I suppose it would be faster this way because the path is already stored somewhere

I don't know if it makes a difference but I am using Windows 7

2

Sadly the exe locations are usually defined in the registry for example. I have .txt defined as opening with "notepad++".

So to find what the association of the file is, I'd have to go to:

"Open Control Panel > Control Panel Home > Default Programs > Set Associations".

From there it'd show Notepad++ is my default program.

I'd then have to go to the registry for Notepad++ e.g.:

"HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Notepad++"

And see the complete file location there something like:

C:\Program Files\Notepad++

EDIT:

Every program you install typically has a registry associated with it, where it can be configured. Most programs details can be found in:

"HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node" (64 bit)
"HKEY_LOCAL_MACHINE\SOFTWARE\" (32 bit)

So you'd need to use regedit.exe to these locations, find your program and view the location of the exe

  • Can you develop a bit more on the "go to the registry for Notepad++" part? – gsmafra Aug 27 '15 at 8:49
  • Edited the main post – Jay Aug 27 '15 at 8:54
  • Small observation: my program was not listed in HKEY_LOCAL_MACHINE\SOFTWARE\ or HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node so I ran the ctrl+f command to find it – gsmafra Aug 27 '15 at 9:23
  • It's not for certain - it's just the typical location. It can vary quite a bit. – Jay Aug 27 '15 at 9:26
6

You can get this information using two command line tools: assoc and ftype:

help assoc
Displays or modifies file extension associations

help ftype
Displays or modifies file types used in file extension associations

You can combine them to produce information you need:
for /f "delims== tokens=2" %a in ('assoc .pdf') do @ftype %a

Running this directly from command line should give you path and parameters of program registered for .pdf files

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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