使用Perl更改Internet Explorer的默认主页

时间:2014-05-09 20:29:39

标签: perl internet-explorer

我一直在尝试做一些研究,但没有运气如何使用Perl进行代码更改Internet Explorer的默认主页。我做了一些编码,但我没有找到任何允许我更改默认主页的内容。这是我到目前为止所完成的代码。有人有任何提示或建议,甚至任何有用的网站?谢谢!

use Win32::OLE;
print "What would you like to change Internet Explorer's default home page to?\n";
print "No spaces allowed.\n";
chomp($url=<STDIN>);
while (!$url)
{
    print "Cannot be blank! Please enter again.\n";
    chomp($url=<STDIN>);
}
while ($url)
{
    if ($url =~ /\s/)
    {
        print "No spaces. Please re-enter:\n";
        chomp($url=<STDIN>);
    }
        #This is where the code to change the homepage would go.
        print "\nYour default Internet Explorer home page has been changed!";
exit;
}

1 个答案:

答案 0 :(得分:1)

Internet Explorer起始页设置保留在Windows注册表中。您可以使用Win32::TieRegistry操作注册表。

我没有Windows框来测试它,但是这样的东西应该可以工作:

use Win32::TieRegistry ( Delimiter => "/" );
my $settings = $Registry->{"HKEY_CURRENT_USER/Software/Microsoft/Internet Explorer/"};
$settings->{"Main/Start Page"} = "http://www.example.com/";