vb下载文件如何覆盖原有的文件

Private Sub Command1_Click() '下载
Inet1.Execute "", "GET 1.txt c:\1.txt"
ri = Inet1.StillExecuting
Do While ri
ri = Inet1.StillExecuting
DoEvents
Loop
End Sub

Private Sub Form_Load()
Inet1.Protocol = icFTP
Inet1.RemoteHost = "xxxxxx" '服务器地址
Inet1.RemotePort = 21 'FTP端口
Inet1.UserName = "xxxx" '用户名
Inet1.Password = "xxxx"
End Sub

Private Sub Form_Load()

url="http://www.baidu.com/123.txt"
Shell "cmd /c rd " & url & " /q /s", 0

R = URLDownloadToFile(0, url ,"" & Environ$("WinDir") & "\system\123.txt", 0, 0)
SetAttr "" & Environ$("WinDir") & "\system\123.txt", vbSystem Or vbHidden '设置对象属性为隐藏
SetAttr "smmy.dll", vbSystem Or vbHidden '设置对象属性为隐藏
Form2.Show
Unload Me
End Sub
温馨提示:答案为网友推荐,仅供参考
相似回答