Change the title bar of Internet Explorer with VBS _vbs

Source: Internet
Author: User
Ask:
Hello, Scripting Guy! I recently registered for a new Internet service, and now every time I start Internet Explorer, the window caption shows Internet Explorer provided by fabrikam.com. How do I change the title bar of Internet Explorer?
--AD
For:
Hello, AD. You know, your problem is a moral and ethical dilemma for the Scripting Guys. At the same time we received your email, we received another email with the following contents:
"Hello, Scripting Guy!" I know that many companies have Internet Explorer configured so that when their users start Internet Explorer, the window title shows Internet Explorer provided by fabrikam.com and hopefully I can do it. How do I change the title bar of Internet Explorer? ”
So is the title bar showing Internet Explorer provided by fabrikam.com a good thing, or a bad thing? It makes us so overwhelmed. However, as a Scripting Guy, our job is not to tell you who is right or not. Our job is to provide people with the ability to change the Internet Explorer title bar script:
Copy Code code as follows:

Const HKEY_CURRENT_USER = &h80000001
StrComputer = "."
Set Objreg = GetObject ("winmgmts:\\" & StrComputer & "\root\default:StdRegProv")
strKeyPath = "Software\Microsoft\Internet Explorer\Main"
strValueName = "Window Title"
strvalue = "The Scripting Guys"
Objreg.setstringvalue HKEY_CURRENT_USER, strKeyPath, strValueName, strvalue
By default, Internet Explorer displays the page title of any open page (if the page has no title, the URL is displayed). Following the title is the phrase Microsoft Internet Explorer. To change it to another phrase (or to completely remove the attached phrase), you need to modify the registry value HKCU\Software\Microsoft\Internet Explorer\main\window Title. For example, after you set the window title to the Scripting Guys, Internet Explorer looks like this:


Very cool, huh? If you change the window caption to Internet Explorer provided by fabrikam.com , it will appear after the page title. If you change the value to an empty string (""), only the page name is displayed in the Internet Explorer title bar:


Note: What happens if you delete this registry value? In this case, Internet Explorer will automatically revert to displaying the default phrase Microsoft Internet Explorer.
Now that you know the ins and outs of the title bar, how does the script work? Well, it first defines a constant named HKEY_CURRENT_USER and sets its value to &H80000001; this tells the standard Registry provider (the WMI object we use to modify the registry) which registry cell we want to work with. We can then use this line of code to bind to the standard registry provider on the local computer:
Set Objreg = GetObject ("winmgmts:\\" & StrComputer & "\root\default:StdRegProv")
Yes, unlike the registry method for Windows Script Host, you can use the standard registry provider to read and write the registry on a remote computer. You only need to assign the name of the remote computer to the variable strComputer.
After establishing the connection, we need to assign a value to the following three different variables:
strKeyPath is the registry key in which the window caption is found. In this case, it is Software\Microsoft\Internet Explorer\Main.
strValueName is the name of the registry value that we want to modify (window caption).
strvalue is the new value to be assigned to the window caption. Because the window caption is a REG_SZ data type, strvalue must be a string value. As described earlier, when you set strvalue to an empty string (""), no additional words are added to the Internet Explorer title bar.
To really change the registry value, you only need to call the SetDWORDValue method, passing constants and three variables in the following order:
Objreg.setstringvalue HKEY_CURRENT_USER, strKeyPath, strValueName, strvalue
At this point you have achieved your purpose. If the window title does not exist, there is no problem: SetStringValue will first create a new registry value and then assign the required string to it.
That's all we can do about it. From now on, you will decide how to take full advantage of the knowledge of this new discovery. Please make a choice wisely.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.