pscp upload using vbs

350 views Asked by At

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
0

There are 0 answers