0

I am attempting to create a function in VBScript that uploads a text file to a remote server using the pscp command. When I run the function, I receive the error

80070002 - The system cannot find the file specified.

Below is the function, I was wondering if there was an issue with the pscp command or if there was an alternative way to upload a file in VBScript.

Function upload(source, dest)
    WScript.Echo source
    Set system = WScript.CreateObject("WScript.Shell")
    system.Run "pscp -batch -pw [PASSWORD HERE] " & source & " [USERNAME HERE]:" & dest, 0, True
    WScript.Echo "....Finished " & vbCrlf
End Function
Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328
  • Does the source path contain spaces? What are the values of `source` and `dest` anyway? – Ansgar Wiechers Aug 28 '17 at 20:52
  • The source path does not contain spaces, and the values source and dest are the source paths from the local and remote servers that are passed into the function. I have tried plugging the paths directly into the function with the same results. – Kevin Thiel Aug 28 '17 at 21:07
  • *\*sigh\** Do I speak Swahili or something? What are the values of `source` and `dest`? Do not paraphrase. You may obfuscate individual folder names if necessary, but keep the structure intact. – Ansgar Wiechers Aug 28 '17 at 23:21
  • @Kein Thiel Check location of pscp program or specify full path on script – JoSerra Aug 29 '17 at 10:28

0 Answers0