简体   繁体   中英

Using Perl to change the url homepage for Internet Explorer

I am using Perl only, and I am trying to code-in the lines that would change the homapage url for Internet Explorer after running this Perl program.

*I am using the header 'use Win32::OLE' which calls on a system file.

*This code is error-free.

#!/usr/bin/perl
use Win32::OLE;

print "What url would you like to make as Internet Explorer's home page?\n";
print "(no spaces, the url as you normally see it on the address bar)\n";
chomp($url=<STDIN>);

while (!$url)
{
    print "You did not make and entry! Please enter a url.\n";
    chomp($url=<STDIN>);
}

while ($url)
{
    if ($url =~ /\s/)
    {
        print "That's not a url! You entered a space somewhere. Re-enter:\n";
        chomp($url=<STDIN>);
    }


    *CODE FOR SETTING HOMEPAGE IN INTERNET EXPLORER HERE*


    print "\nYour home page in IE has been changed! Re-open IE and see!";
exit;
}

You could use Win32::TieRegistry ( https://metacpan.org/module/ADAMK/Win32-TieRegistry-0.26/lib/Win32/TieRegistry.pm ) to edit the registry to set:

[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main]
"Start Page"="http://www.example.com/"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM