回复 1# ikxy
我不怎么懂VBS 但是这样也能解决你说的问题$Globaldir = IniRead("config.ini", "con", "Globaldir", "ERRER")
$Setmenu = IniRead("config.ini", "con", "Setmenu", "ERRER")
$Baidurl = IniRead("config.ini", "con", "Baidurl", "ERRER")
$Setting = IniRead("config.ini", "con", "Setting", "ERRER")
_runvbs($Globaldir, $Setmenu, $Baidurl, $Setting)
Func _runvbs($Globaldir, $Setmenu, $Baidurl, $Setting)
Local $VBCode = 'Dim iSetmenu:iSetmenu=1' & @CRLF
$VBCode &= 'Dim fsobject,Setmenu,Baidurl,Setting,Globaldir' & @CRLF
$VBCode &= 'Globaldir = "' & $Globaldir & '"' & @CRLF
$VBCode &= 'Setmenu = "' & $Setmenu & '"' & @CRLF
$VBCode &= 'Baidurl = "' & $Baidurl & '"' & @CRLF
$VBCode &= 'Setting = "' & $Setting & '"' & @CRLF
$VBCode &= 'Set oShell = CreateObject("WScript.Shell")' & @CRLF
$VBCode &= 'Set fsobject = CreateObject("Scripting.FileSystemObject")' & @CRLF
$VBCode &= ' SetMenuaddREGoShellObject = oShell.REGWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\Setmenu"_' & @CRLF
$VBCode &= ',fsobject.GetFile(Wscript.ScriptFullName).ParentFolder.Path _' & @CRLF
$VBCode &= '& "" & _' & @CRLF
$VBCode &= 'WScript.ScriptName)' & @CRLF
$VBCode &= ' IF Not fsobject.FileExists(Globaldir&"Setmenu.bak") Then' & @CRLF
$VBCode &= ' TempbackupSetmenu = fsobject.Copyfile (Globaldir&Setmenu,Globaldir&"Setmenu.bak",true)' & @CRLF
$VBCode &= ' End IF' & @CRLF
$VBCode &= 'Do While iSetmenu > 0 ' & @CRLF
$VBCode &= ' Set ReadSetmenuString = fsobject.OpenTextFile(Globaldir&Setmenu) ' & @CRLF
$VBCode &= ' GetSetmenuString = ReadSetmenuString.Readall ' & @CRLF
$VBCode &= ' ReadSetmenuString.Close ' & @CRLF
$VBCode &= ' TempSetMenuString = Replace(GetSetmenuString,Baidurl,Setting) ' & @CRLF
$VBCode &= ' Set ResSetmenuString = fsobject.Createtextfile(Globaldir&Setmenu) ' & @CRLF
$VBCode &= ' ResSetmenuString.Write TempSetMenuString' & @CRLF
$VBCode &= ' ResSetmenuString.Close ' & @CRLF
$VBCode &= 'iCounter = iSetmenu + 1' & @CRLF
$VBCode &= 'IF iCounter < 0 Then WScript.Quit' & @CRLF
$VBCode &= 'WScript.Sleep(1000*10*6*5)' & @CRLF
$VBCode &= 'Loop ' & @CRLF
$VBCode &= 'Set fsobject = Nothing' & @CRLF
$VBCode &= 'WScript.Quit' & @CRLF
Local $VBScript = ObjCreate('ScriptControl')
$VBScript.language = 'vbscript'
$VBScript.addcode($VBCode)
Return $VBScript.run($Globaldir, $Setmenu, $Baidurl, $Setting)
EndFunc ;==>_runvbs
INI文件名 config.ini
[con]
Globaldir = "E:\lujing\"
Setmenu = "file.dat"
Baidurl = "http://www.baidu.com/"
Setting = "http://www.hao123.com" |