Tech Support banner

Status
Not open for further replies.
1 - 14 of 14 Posts

·
Registered
Joined
·
6 Posts
Discussion Starter · #1 ·
I'm having some difficulty with a (fairly) simple batch file.
I simply need to edit [HKEY_CLASSES_ROOT\.html] as certain pesky browsers like to change the value. Here is what I have:

REGEDIT4
; @ECHO OFF
; CLS
; REGEDIT.EXE /S "%~f0"
; EXIT
[HKEY_CLASSES_ROOT\.html]
"(Default)"="htmlfile"

It does everything perfect, EXCEPT it does not edit the (Default) value. Instead it just adds a second entry called (Default).

Any suggestions?
 

·
Registered
Joined
·
1,701 Posts
I think you should do a Reg Delete for that keyname. Then do a Reg Add to restore what you want.

Here's some guidelines: Reg command help

But, I never have pesky browsers trying to change that value since I carefully check the options during install and turn off the nags or the automatic settings that would try to do that. You can do that after install in all the browsers I'm familiar with in 'Settings'.
 

·
Registered
Joined
·
6 Posts
Discussion Starter · #3 ·
I never have those problems personally, however with around 8,000 End Users, there's always a few that miss it ;)
 

·
Registered
Joined
·
1,701 Posts
Wow, 8,000 end users. I'm impressed. Handling that many would be a career in and of itself. I'll look for your name in the list of 'IT Pros that have gone nuts' :)

Anyway, I think the DEL/ADD trick is the way to handle the issue.
 

·
Registered
Joined
·
6 Posts
Discussion Starter · #5 ·
Ha! Just part of a team.

And I had considered that, so it's good to hear someone else suggest it as well. Thank you!
 

·
Registered
Joined
·
6 Posts
Discussion Starter · #7 ·
It's 'almost' working. I'm using the following script:

REGEDIT4
; @ECHO OFF
; CLS
; REGEDIT.EXE /S "%~f0"
; EXIT
[-HKEY_CLASSES_ROOT\.html]
[HKEY_CLASSES_ROOT\.html]
"(Default)"="htmlfile"
"Content Type"="text/html"
"PerceivedType"="text"

I end up with 2 keys called (Default), one has the correct entry, the actual default value is not adjusted. Is there some additional command I can add in to edit the Default value for that particular registry key?

PS: Nice Post count Jim
 

·
Registered
Joined
·
1,701 Posts
1) Check the permissions for that key. Make sure you have rights to alter the settings for it.

2) [-HKEY_CLASSES_ROOT\.html] doesn't DEL, it ADDs; at least it does when I try it here on my computer.
 

·
Registered
Joined
·
1,701 Posts
After two hours of playing with this, it appears that it won't let me delete or change the value for (Default). Like in your script, mine just tends to add another (Default) value. Usually returning an error that it can't find the value. But a following 'Add' using pretty much the same operators does add another (Default) with the value htmlfile.

Seems that value is sacrosanct for some reason and resists change.

Meanwhile, still working on it.
 

·
Registered
Joined
·
1,701 Posts
OK, got it.

Direct your script to do a 'Reg Export' of the key .html and save it as a .reg file.

Then have your batch file edit the (Default) value in the reg file.

Then your script would 'Import' that key into the registry. That actually over writes the default setting without adding another (Default).

I couldn't find any other method that worked on it.
 

·
Registered
Joined
·
6 Posts
Discussion Starter · #11 · (Edited)
I figured it out finally. (Default) is represented as the @ symbol.
I do not know the technical reason, probably something to do with the way the registry is coded.

Here's the the little script I came up with:
Code:
REGEDIT4
 
  ; @ECHO OFF
  ; CLS
  ; REGEDIT.EXE /S "%~f0"
  ; EXIT
 
[HKEY_CLASSES_ROOT\.html]
@="htmlfile"
 
[HKEY_CLASSES_ROOT\.htm]
@="htmfile"
 
[HKEY_CLASSES_ROOT\.shtml]
@="shtmlfile"
 
[HKEY_CLASSES_ROOT\.xhtml]
@="xhtmlfile"
 
[HKEY_CLASSES_ROOT\.xml]
@="xmlfile"
I use this specifically because Reader installs Chrome if people forget to uncheck the box for the install. Chrome then edits the registry for these files.
Several websites our clients use work on nothing but IE (they are ancient) so I delete Chrome.

After that, Users that receive hyperlinks in Outlook get an error when trying to click them. To fix this the internet file types must be edited in the registry. This does that for me.
 

·
Registered
Joined
·
1,701 Posts
Well fine. All that 2.5 hours of work for nothing. :)

But your solution looks more 'modern', 'streamlined' and 'elegant' then mine. So, well done. Where did you find that '@' used for 'Default' would work?
 

·
Registered
Joined
·
6 Posts
Discussion Starter · #13 ·
I found it at this link:
Windows Vista Registry How To Create .Reg Files. Edit .reg file

About 4/5 of the way down the page I saw this:
@ At symbol

As you get more experienced with .reg examples, you may discover the @. Since the @ is found on the first line of the code proper, this is a clue that it means the default setting. Thus rather than saying
Default="xmlfile"
The .reg file uses: @="xmlfile"
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.xml]
@="xmlfile"
"Content Type"="text/xml"
"PerceivedType"="text"

[HKEY_CLASSES_ROOT\.xml\PersistentHandler]
@="{7E9D8D44-6926-426F-AA2B-217A819A5CCE}"
 

·
Registered
Joined
·
1,701 Posts
Yeah, I was thinking the whole time that the () around Default was significant and probably the wrong call out in script but I didn't find the page you found.

Well, good job, you taught me something.
 
1 - 14 of 14 Posts
Status
Not open for further replies.
Top