欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

用VBS可執(zhí)行程序+Xmlhttp下載備份網(wǎng)上文件的代碼

 更新時(shí)間:2007年08月08日 10:58:17   作者:  
今天寫程序時(shí)突然想到做一個(gè)文件的備份,把網(wǎng)站上的數(shù)據(jù)庫備份到本地機(jī)上。一個(gè)簡(jiǎn)單的小程序,做成可執(zhí)行的文件,用VBS最簡(jiǎn)單方便了。 'On Error Resume Next 
Dim iRemote,iLocal 
iRemote = InputBox("請(qǐng)輸入遠(yuǎn)程文件路徑:") 
Set xPost = CreateObject("Microsoft.XMLHTTP") 
xPost.Open "GET",iRemote,0 
xPost.Send() 
Set stream = CreateObject("ADODB.Stream") 
stream.Mode = 3 
stream.Type = 1 
stream.Open() 
stream.Write(xPost.responseBody) 
if (stream.size<10240) then 
    MsgBox("遠(yuǎn)程文件不存在!") 
else 
    SaveFile 
end if 
stream.close 
set stream = nothing 

' 保存文件 
function SaveFile 
    iLocal = InputBox("請(qǐng)輸入本機(jī)保存路徑:") 
    Set fso = CreateObject("Scripting.FileSystemObject") 
    returnValue = "0" 
    if (fso.FileExists(iLocal)) then 
        returnValue = MsgBox("'"&iLocal&"'文件已存在,真的要覆蓋嗎?",vbYesNoCancel,"確認(rèn)框") 
    end if 
    set fso = nothing 
    if (returnValue = "6" or returnValue = "0") then '覆蓋 
        stream.SaveToFile iLocal,2 
        MsgBox("文件備份成功!") 
    elseif (returnValue = "7") then 
        SaveFile 
    end if 
end function

相關(guān)文章

最新評(píng)論