我在让脚本正常工作时遇到了一些困难。我已经下载了 PSCP.exe 附带的 PuTTY 包,我打算用它来从 SFTP 服务器下载/复制文件,然后将它们保存或写入我的本地驱动器。
下面是我改为下载的上传脚本的骨架。
尝试运行脚本时出现以下错误:
Windows Script Host
Script: C:\Script.txt
Line: 2
Char: 20
Error: Expected '='
Code: 800A03F3
Source: Microsoft VBScript compilation error
有人可以指出我正确的方向吗?
提前致谢,
-T
Sub SftpGet()
Const cstrSftp As String = """C:\Program Files\PuTTY\pscp.exe"""
Dim strCommand As String
Dim pUser As String
Dim pPass As String
Dim pHost As String
Dim pFile As String
Dim pRemotePath As String
pUser = "USER" '//User on remote system
pPass = "PASSWORD" '//User's password on remote system
pHost = "SFTP.WEBSITE.ORG" '//Ip address of remote system
pFile = "C:\Important_Info_Copy.txt" '//File to write copy of "pRemotePath" to
pRemotePath = "/Important_Info.txt" '//Location of file to copy
strCommand = cstrSftp & " -sftp -l " & pUser & " -pw " & pPass & pHost & ":" & pRemotePath &_
" " & pFile &
Debug.Print strCommand
Shell strCommand, 1 ' vbNormalFocus '
End Sub