如何通过VBScript在Windows中打开FTP文件夹 [英] How to open an FTP folder in Windows via VBScript

查看:223
本文介绍了如何通过VBScript在Windows中打开FTP文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

到目前为止我的代码是:

pre $ set $ o $ c $ Set b
Set objFSO = CreateObject(Scripting.FileSystemObject)
set objShell = CreateObject(WScript.Shell)

'复制选项:16 =全部是
Const copyType = 16

'FTP等待时间ms
waitTime = 80000

FTPUser =myuser
FTPPass =mypass
FTPHost =ftp IP
FTPDir =/ Creative /

strFTP =ftp://& FTPUser& +& FTPPass& @& FTPHost& FTPDir
Set objFTP = oShell.NameSpace(strFTP)

我可以连接到我的FTP文件夹,现在我需要在Windows资源管理器中打开该文件夹。 这样:

pre $ set $ objShell = CreateObject(WScript.Shell)
Login =您的用户名
'如果您的用户名包含@符号,并且您的网络浏览器不支持此操作,则可以替换+
Login = Replace(Login,@,+)
Password = 您的通行证
FTPSERVER =ftp.server.com
RemoteFolder =RemoteFolderName
FTPURL =ftp://&登入&:&密码&@& FTPSERVER&/& RemoteFolder
Connect2FTP = objShell.run(Explorer& FTPURL,1,False)

我做了一个旧的vbscript来处理这个问题



描述:

您与朋友或网吧在不同的计算机上?
您想要添加,修改,删除FTP服务器上的文件或文件夹吗?
没有机会,您没有FTP客户端程序(FileZilla,CuteFTP,FlashFXP等)访问您的私人FTP服务器!
没有问题=> FTP Explorer是在您的FTP客户端中打开您的Web浏览器或Windows资源管理器的解决方案!



我只是翻译这个旧的法语版本 b
$ b

希望能帮到你!

  Titre =FTP EXPLORER©Hackoo©2016
Set objIE = CreateObject(InternetExplorer.Application )
objIE.Navigateabout:blank
objIE.Document.Title = Titre
objIE.ToolBar = False
objIE.Resizable = False
objIE.StatusBar = False
objIE.Width = 320
objIE.Height = 390
ScreenWidth = objIE.document.ParentWindow.screen.width
ScreenHeight = objIE.document.ParentWindow.screen.height
objIE.Left =(ScreenWidth - objIE.Width) \\ 2
objIE.Top =(ScreenHeight - objIE.Height)\ 2
Do while objIE.Busy
WScript.Sleep 200
Loop
objIE.Document。 Body.InnerHTML =< div align =center>< p>< h3 style ='color:Red'> UserName_
& < br>< input type =textstyle ='color:Blue'size =20_
& id =Loginvalue =把用户名放在这里>< / h3>< / p>_
& < / p>< p>< h3 style ='color:Red'>密码< br>< input type =passwordstyle ='color:Blue'value =这里size =20_
& id =Password>< / h3>< / p>< p>< input type =_
& hiddenid =OKname =OKvalue =0> _
& < h3 style ='color:Red'> FTP服务器_
& < br>< input type =textstyle ='color:Blue'size =20_
& id =FTPSERVERvalue =ftp.server.com>< / h3>_
& < br>< h3 style ='color:Red'>远程文件夹_
& < br>< input type =textstyle ='color:Blue'size =20_
& id =DossierDistantvalue =/ www&g​​t;< / h3>< / p>_
& < input type =submitvalue =浏览您的FTP文件夹_
& 点击= 的VBScript:OK.Value = 1 >< / P>< / DIV> 中
objIE.Document.Body.Style.overflow =auto
objIE.Document.body.style.backgroundcolor =lightGreen
objIE.Visible = True
objIE.Document .All.Password.Focus
On Error Resume Next
Do while objIE.Document.All.OK.Value = 0
WScript.Sleep 200
If Err Then
IELogin = Array(,)
objIE.Quit
Set objIE = Nothing
wscript.quit
End if
Loop
On Error Goto 0
Set ws = CreateObject(wscript.Shell)
Login = objIE.Document.All.Login.Value
Login = Replace(Login,@,+)'如果您的用户名包含@符号,并且您的Web浏览器不支持此操作,则可以替换+
Password = objIE.Document.All.Password.Value
FTPSERVER = objIE.Document.All。 FTPSERVER.Value
DossierDistant = objIE.Document.All.DossierDistant.Value
URL =ftp://& Login&:& Password&@& FTPSERVER&/& DossierDistant
Connect2FTP = ws.run(Explorer& URL,1,False)
objIE.Quit
ws.Popup正在连接& qq(FTPSERVER)&正在进行..........,3, 正在连接& qq(FTPSERVER)&正在进行..........,64
Set objIE = Nothing
Set ws = Nothing
关闭(iexplore.exe)
'************************************** **************
Sub Close(Process)
Set Ws = CreateObject(Wscript.Shell)
Command =cmd / c Taskkill / F / IM& Process&
Execution = Ws.Run(Command,0,True)
End Sub
'************* ***************************************
函数qq(strIn)
qq = Chr(34)& strIn& Chr(34)
End Function
'*********************************** *****************


My code so far:

Set oShell = CreateObject("Shell.Application")
Set objFSO = CreateObject("Scripting.FileSystemObject")
 set objShell = CreateObject("WScript.Shell")

'Copy Options: 16 = Yes to All
Const copyType = 16

'FTP Wait Time in ms
waitTime = 80000

FTPUser = "myuser"
FTPPass = "mypass"
FTPHost = "ftp IP"
FTPDir = "/Creative/"

strFTP = "ftp://" & FTPUser & "+" & FTPPass & "@" & FTPHost & FTPDir
Set objFTP = oShell.NameSpace(strFTP)

I am able to connect to my FTP folder, now I need to open that folder in Windows explorer.

You can try like this way :

set objShell = CreateObject("WScript.Shell")
Login = "Your Username"
'If your username contains the @ symbol, and your web browser does not support this, you can substitute for the +
Login = Replace(Login,"@","+")
Password = "Your Pass"
FTPSERVER = "ftp.server.com"
RemoteFolder = "RemoteFolderName"
FTPURL = "ftp://"& Login &":"& Password &"@"& FTPSERVER &"/"& RemoteFolder
Connect2FTP = objShell.run("Explorer "& FTPURL ,1,False)

I have done an old vbscript to deal like that

Description :

You are on a different computer than you, either with friends or in a cybercafe? You want to add, modify, delete files or folders on your FTP server? No chance, you do not have programs on hand as FTP clients like (FileZilla, CuteFTP, FlashFXP. Etc ...) to access your Private FTP server ! No problem => FTP Explorer is the solution to turn your web browser or windows explorer in your FTP client !

I'd just translate this old french version to english version !

Hope that can help you !

Titre = "FTP EXPLORER © Hackoo © 2016"
    Set objIE = CreateObject( "InternetExplorer.Application" )
    objIE.Navigate "about:blank"
    objIE.Document.Title = Titre
    objIE.ToolBar        = False
    objIE.Resizable      = False
    objIE.StatusBar      = False
    objIE.Width          = 320
    objIE.Height         = 390
    ScreenWidth = objIE.document.ParentWindow.screen.width 
    ScreenHeight = objIE.document.ParentWindow.screen.height
    objIE.Left = (ScreenWidth  - objIE.Width ) \ 2
    objIE.Top  = (ScreenHeight - objIE.Height) \ 2
    Do While objIE.Busy
        WScript.Sleep 200
    Loop
    objIE.Document.Body.InnerHTML = "<div align=""center""><p><h3 style='color:Red'>UserName " _
    & "<br><input type=""text"" style='color:Blue' size=""20"" " _
    & "id=""Login"" value=""put your user name here""></h3></p>"_
    & "</p><p><h3 style='color:Red'>Password<br><input type=""password"" style='color:Blue' value=""Put your password here"" size=""20"" " _
    & "id=""Password""></h3></p><p><input type=" _
    & """hidden"" id=""OK"" name=""OK"" value=""0"">" _
    & "<h3 style='color:Red'>FTP Server " _
    & "<br><input type=""text"" style='color:Blue' size=""20"" " _
    & "id=""FTPSERVER"" value=""ftp.server.com""></h3>"_
    & "<br><h3 style='color:Red'>Remote Folder "_
    & "<br><input type=""text"" style='color:Blue' size=""20"" " _
    & "id=""DossierDistant"" value=""/www""></h3></p>"_
    & "<input type=""submit"" value="" Browse your FTP Folder"" " _
    & "onclick=""VBScript:OK.Value=1""></p></div>"
    objIE.Document.Body.Style.overflow = "auto"
    objIE.Document.body.style.backgroundcolor="lightGreen"
    objIE.Visible = True
    objIE.Document.All.Password.Focus
    On Error Resume Next
    Do While objIE.Document.All.OK.Value = 0
        WScript.Sleep 200
        If Err Then    
            IELogin = Array( "", "" )
            objIE.Quit
            Set objIE = Nothing
            wscript.quit
        End if
    Loop
    On Error Goto 0
    Set ws = CreateObject("wscript.Shell")
    Login = objIE.Document.All.Login.Value
    Login = Replace(Login,"@","+")'If your username contains the @ symbol, and your web browser does not support this, you can substitute for the +
    Password = objIE.Document.All.Password.Value
    FTPSERVER = objIE.Document.All.FTPSERVER.Value
    DossierDistant = objIE.Document.All.DossierDistant.Value
    URL = "ftp://"&Login&":"&Password&"@"&FTPSERVER&"/"&DossierDistant
    Connect2FTP = ws.run("Explorer "& URL ,1,False)
    objIE.Quit
ws.Popup "Connecting to "&qq(FTPSERVER)&" is in progress ..........",3,"Connecting to "&qq(FTPSERVER)&" is in progress ..........",64
    Set objIE = Nothing
    Set ws = Nothing
    Close("iexplore.exe")
'****************************************************
Sub Close(Process)
    Set Ws = CreateObject("Wscript.Shell")
    Command = "cmd /c Taskkill /F /IM "&Process&""
    Execution = Ws.Run(Command,0,True)
End Sub
'****************************************************
Function qq(strIn) 
    qq = Chr(34) & strIn & Chr(34)
End Function
'****************************************************

这篇关于如何通过VBScript在Windows中打开FTP文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆