Use vbs to change the title bar of Internet Explorer

Source: Internet
Author: User

Q:
Hello, script expert! Recently I registered a new Internet service. Now, every time I start Internet Explorer, the window title displays Internet Explorer provided by Fabrikam.com. How do I change the title bar of Internet Explorer?
-- AD
A:
Hello, AD. As you know, your problem has left the scripting experts in a dilemma in terms of ethics and ethics. When we receive your email, we receive another email with the following content:
"Hello, script expert! I know many companies have configured Internet Explorer, so that every time their users start Internet Explorer, the window title displays Internet Explorer provided by Fabrikam.com, and I hope I can do it too. How do I change the title bar of Internet Explorer ?"
So, is it a good thing or a bad thing to show that Internet Explorer is provided by Fabrikam.com? This leaves us at a loss. However, as a scripting expert, our job is not to tell you whether or not it is. Our job is to provide people with scripts that can change the title bar of Internet Explorer: Copy codeThe Code is 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 title of any page that opens a webpage (if the page has no title, the URL is displayed ). Microsoft Internet Explorer is followed by the title. To change it to another phrase (or delete an additional phrase completely), 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 will be shown in:

Cool, huh? If you change the window titleInternet Explorer is provided by Fabrikam.com, It will be displayed after the page title. If you change the value to an empty string (""), only the Page name is displayed in the title bar of Internet Explorer:


Note: What if you delete this registry value? In this case, Internet Explorer is automatically restored to 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 Unit should we use. Then, we can bind the following line of code to the standard registry provider on the local computer:
Set objReg = GetObject ("winmgmts :\\" & strComputer & "\ root \ default: StdRegProv ")
Yes, unlike the Windows Script Host registry, you can use the standard registry provider to read and write the registry on a remote computer. You only need to assign the remote computer name to the variable strComputer.
After the connection is established, we need to assign values to the following three different variables:
• StrKeyPath is the registry key in which the window title is found. In this example, It is Software \ Microsoft \ Internet Explorer \ Main.
• StrValueName is the name of the registry value to be modified (window title ).
• StrValue is the new value to be assigned to the window title. Because the window title is of the REG_SZ data type, strValue must be a string value. As described above, when strValue is set to an empty string (""), no additional words are added to the title bar of Internet Explorer.
To change the registry value, you only need to call the SetDWORDValue method to pass constants and three variables (in the following order ):
ObjReg. SetStringValue HKEY_CURRENT_USER, strKeyPath, strValueName, strValue
So far, you have achieved your goal. If the window title does not exist, there is no problem: SetStringValue first creates a new registry value and then assigns it the required string.
We can only do this. From now on, it is up to you to decide how to make full use of this new discovery knowledge. Make a wise choice.

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.