2014-05-09 24 views
0

我一直在嘗試做一些研究,但沒有運氣如何使用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

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/"; 
+0

非常感謝。這很完美! – StrikerMcP