I have checked a bunch of different places for a solution to this and it seems so basic, yet when I try it, the thing doesn't like me.
I a writing vbscript which executes psftp.exe, logs into a remote SFTP site, and grabs files referenced in a properties file.
The goal is to redirect output to a local log file. this is the vbs:
Public Sub execute(sftp)
if sftp.privateKey <> "" Then
cmd = ".\psftp.exe " _
& " -l " & sftp.user _
& " -P " & sftp.port _
& " -i " & sftp.privateKey _
& " " & sftp.name _
& " -bc " & propFileName _
& " -v -bc >> D:\SFTP_Jobs\logFile.txt"
msgBox "Executing: " & ".\psftp.exe " _
& " -l " & sftp.user _
& " -P " & sftp.port _
& " -i " & sftp.privateKey _
& " " & sftp.name _
& " -bc " & propFileName _
& " -v -bc >> D:\SFTP_Jobs\logFile.txt"
Else
cmd = ".\psftp.exe " _
& sftp.name _
& " -pw " & pw _
& " -b " & PropFileName _
& " -v -bc >> D:\SFTP_Jobs\logFile.txt"
msgBox "Executing: " & ".\psftp.exe " _
& sftp.name _
& " -pw XXXXXXXX" _
& " -b " & PropFileName _
& " -v -bc >> D:\SFTP_Jobs\logFile.txt"
End If
Dim TheShell: Set TheShell = WScript.CreateObject("WScript.Shell")
TheShell.Run(cmd),0 , True
set TheShell = Nothing
End Sub 'execute
This cmd ends up looking like
psftp.exe theBankIworkFor@ftp.oneOfOurVendors.com -pw thePw -b batchfile.properties -v -bc > D:\SFTP_Jobs\logFile.txt"
This command has been working just fine until I added everything after the -v option...
I apologize in advance if there is something extremely obvious about this