Need Help Associating File Extensions / Open With

(imported topic written by tscott91)

It appears that Office SP3 is breaking the .tif file extention… I’ve had numerous calls from users saying they can’t open tif’s anymore…

There is a dos command “assoc” that allows you manage file type and extension associations… When I type:

assoc .tif I get the results ".tif= "

What it needs to be is “.tif=tiffile”

So, in order to do that I simply type the command: assoc .tif=tiffile

From there, I now need to assign a program to open the tif files. This is where it gets tricky as every PC isn’t going to use the same thing…

By using the command “ftype” and the exact command: ftype jpegfile I get what program the computer is using to open jpgs… For example the return value on a particular PC is “rundll32.exe C:\WINDOWS\system32\shimgvw.dll,ImageView_Fullscreen %1”

So, I then used the command: ftype tiffile=rundll32.exe C:\WINDOWS\system32\shimgvw.dll,ImageView_Fullscreen %1 to assign tif files to open with this program…

Anyone have any ideas on how to accomplish this smoothly?

(imported comment written by SystemAdmin)

I have used the follow to change .pdf to open with Adobe. You would have to do some testing to what the registry key looks like for .tif

delete __appendfile

appendfile Windows Registry Editor Version 5.00

appendfile

http://HKEY_CLASSES_ROOT.pdf

appendfile “Content Type”=“application/pdf”

appendfile @=“AcroExch.Document”

delete pdf.reg

move __appendfile pdf.reg

wait regedit.exe -s pdf.reg

(imported comment written by SystemAdmin)

Also the following relevacy expression could be helpful to identify what you have out there.

((name of it as string) & " - v." & (version of it as string)) of application of key “.pdf” of key “HKEY_CLASSES_ROOT” of native registry

(imported comment written by tscott91)

Thanks much for the reply. It helps a lot…

Question on your relevance… When I run that I get: “Foxit Reader.exe - v.4.0.0.619”… However, in my HKEY_CLASSES_ROOT.pdf I don’t see any mention of “application”… I see “(Default)” but how does your statement pull that value?

Thanks

(imported comment written by tscott91)

As far as setting relevance for this fixlet. How would I make it so only PC’s that have the below appear:

HKEY_CLASSES_ROOT.tif - String name “(Default)” with a value of blank or “value not set”

(imported comment written by SystemAdmin)

You could run the following:

exist application of key “HKEY_CLASSES_ROOT.tif” of native registry

I do not know for sure where it pulls the application details, this is what the relevancty inspector says:

application of

Creates the application object associated with the named command. Normally used with a sub-key of key HKEY_CLASSES_ROOT whose name is a file type.

(imported comment written by tscott91)

I’ve actually learned that changing just those registry keys doesn’t completely control what program opens files…

By doing assoc .pdf it gives the association type

assoc.pdf

.pdf=FoxitReader.Document

Then you need to do an ftype foxitreader.document to see what program is assigned to open.

ftype foxitreader.document

foxtreader.document=“C:\Program Files\Foxit Software\Foxit Reader\Foxit Reader.exe” “%1”

So, if you need to change what it opens with you just do

ftype FoxitReader.Document=“C:\Program Files\Foxit Software\Foxit Reader\Foxit Reader.exe” “%1”

Now… My issue now is writing relevance for this… I know the keys I have to check but can’t figure out the syntax because of the specific characters (the quotes and the %)… Here is what I need:

q: default value of key “HKEY_CLASSES_ROOT\Applications\Foxit Reader.exe\shell\open\command” of registry != “C:\Program Files\Foxit Software\Foxit Reader\Foxit Reader.exe” “%1”

E: A string constant had an improper %-sequence.

If I just query it I get:

q: default value of key “HKEY_CLASSES_ROOT\Applications\Foxit Reader.exe\shell\open\command” of registry

A: “C:\Program Files\Foxit Software\Foxit Reader\Foxit Reader.exe” “%251”

So I try using that and get:

q: default value of key “HKEY_CLASSES_ROOT\Applications\Foxit Reader.exe\shell\open\command” of registry != “C:\Program Files\Foxit Software\Foxit Reader\Foxit Reader.exe” “%251”

E: This expression could not be parsed.

(imported comment written by SystemAdmin)

If you take the string after != and replace all " with %22 (including ones at beginning and end), replace the % with %25 (as you did), then wrap the whole thing in double-quotes.

Hopefully that should work for you.

(imported comment written by tscott91)

Still no dice… :frowning:

q: default value of key “HKEY_CLASSES_ROOT\Applications\Foxit Reader.exe\shell\open\command” of registry != “%22C:\Program Files\Foxit Software\Foxit Reader\Foxit Reader.exe%22” “%22%251%22”

E: This expression could not be parsed.

q: default value of key “HKEY_CLASSES_ROOT\Applications\Foxit Reader.exe\shell\open\command” of registry != “”%22C:\Program Files\Foxit Software\Foxit Reader\Foxit Reader.exe%22 %22%251%22""

E: This expression contained a character which is not allowed.

(imported comment written by NoahSalzman)

You have some extra quotes in there.

q: default value of key “HKEY_CLASSES_ROOT\foxitreader.document\shell\open\command” of registry

A: “C:\PROGRA~1\FOXITS~1\FOXITR~1\FOXITR~1.EXE” “%251”

q: default value of key “HKEY_CLASSES_ROOT\foxitreader.document\shell\open\command” of registry = “%22C:\PROGRA~1\FOXITS~1\FOXITR~1\FOXITR~1.EXE%22 %22%251%22”

A: True

q: default value of key “HKEY_CLASSES_ROOT\foxitreader.document\shell\open\command” of registry != “%22C:\PROGRA~1\FOXITS~1\FOXITR~1\FOXITR~1.EXE%22 %22%251%22”

A: False

Note that my key is not in the same path as yours… I’m just trying to demonstrate the example of %22 versus double quotes.

(imported comment written by tscott91)

Awesome. Thank you!

Question, where is the documentation for the characters that need replaced when using relevance?

(imported comment written by tscott91)

Ok… The relevance code works but it doesn’t look like the relavance itself is working…

q: default value of key “HKEY_CLASSES_ROOT\Applications\Foxit Reader.exe\shell\open\command” of registry != “%22C:\Program Files\Foxit Software\Foxit Reader\Foxit Reader.exe%22 %22%2511%22”

A: True

So the above is saying the value of that key is NOT the value entered and it’s returning true… However, the value IS that…

q: default value of key “HKEY_CLASSES_ROOT\Applications\Foxit Reader.exe\shell\open\command” of registry

A: “C:\Program Files\Foxit Software\Foxit Reader\Foxit Reader.exe” “%251”

(imported comment written by MrFixit)

I used a different application and I’m looking for it to = vs. not eqal but you should lbe able to follow the examples:

q: default value of key “HKEY_CLASSES_ROOT\Applications\AcroRD32.exe\shell\Read\command” of registry = “%22C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe%22 %22%251%22”

A: True

T: 0.389 ms

I: singular boolean

q: “%22C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe%22 %22%251%22”

A: “C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe” “%251”

T: 0.021 ms

I: singular string

(imported comment written by NoahSalzman)

%2511 vs %251

perhaps

(imported comment written by tscott91)

Ok… Got it working and now want to take a step further… I want to use regapp path instead of an absolute path… My problem I believe is that it’s looking for the path to be wrapped in quotes but with my code it isn’t and I don’t know how to get it wrapped in quotes… See below.

q:pathname of regapp “scalc.exe”

A: C:\Program Files\OpenOffice.org 3\program\scalc.exe

q: default value of key “HKEY_CLASSES_ROOT\opendocument.CalcTemplate.1\shell\open\command” of registry

A: “C:\Program Files\OpenOffice.org 3\program\scalc.exe” -o “%251”

q: default value of key “HKEY_CLASSES_ROOT\opendocument.CalcTemplate.1\shell\open\command” of registry = pathname of regapp “scalc.exe” & " -o " & “%22%251%22”

A: False

q: pathname of regapp “scalc.exe” & " -o " & “%22%251%22”

A: C:\Program Files\OpenOffice.org 3\program\scalc.exe -o “%251”

(imported comment written by SystemAdmin)

Pretty much the same thing again, as you want to ensure your final string is enclosed in double quotes and everything else inside is handled using escaped characters:

“%22” & pathname of regapp “scalc.exe” & “%22 -o %22%251%22”

or if you find that doesn’t look clear in the code when you go back and look at it

“%22” & pathname of regapp “scalc.exe” & “%22” & " -o " & " %22" & “%251” & “%22”

(imported comment written by tscott91)

Perfect. Thanks again!

(imported comment written by tscott91)

Another issue…

Actual value of registry: rundll32.exe C:\WINDOWS\system32\shimgvw.dll,ImageView_Fullscreen %1

Relevance

q: default value of key “HKEY_CLASSES_ROOT\TIFImage.Document\shell\open\command” of registry

A: rundll32.exe C:\WINDOWS\system32\shimgvw.dll,ImageView_Fullscreen %251%00

q: default value of key “HKEY_CLASSES_ROOT\TIFImage.Document\shell\open\command” of registry = “rundll32.exe C:\WINDOWS\system32\shimgvw.dll,ImageView_Fullscreen %251”

A: True

q: default value of key “HKEY_CLASSES_ROOT\TIFImage.Document\shell\open\command” of registry = “rundll32.exe C:\WINDOWS\system32\shimgvw.dll,ImageView_Fullscreen %251%00”

A: True

What am I doing wrong here? The registry doesn’t show anything after the %1 but BigFix debugger adds “%00”. I tried both with and without it and it’s not working…

(imported comment written by gjeremia91)

The registry entry you are looking at is probably a REG_EXPAND_SZ, not a REG_SZ. (i.e. an expandable string versus a simple string). From the registry perspective, this is a null (%00) terminated string, so those nulls actually exist, even if nothing lives after it !

Here’s post I wrote some time ago about recovering file associations. The logic in is is relevant to this conversation

http://forum.bigfix.com/viewtopic.php?id=4201