2

我只使用 Perl,我正在尝试在运行此 Perl 程序后更改 Internet Explorer 的主页 url 的行中编写代码。

*我正在使用调用系统文件的标题“使用 Win32::OLE”。

*此代码没有错误。

#!/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;
}
4

1 回答 1

2

您可以使用 Win32::TieRegistry ( https://metacpan.org/module/ADAMK/Win32-TieRegistry-0.26/lib/Win32/TieRegistry.pm ) 编辑注册表以设置:

[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main]
"Start Page"="http://www.example.com/"
于 2013-05-15T17:37:32.817 回答