Bonjour

Je tente d'utiliser une appli putty pour envoyer un fichier sur un serveur SFTP et rien ne se passe. J'ai une erreur quelqu'part mais je sais ni ou ni quoi.

Vu que personne sur terre ne peut bosser sans informations il doit y avoir une astuce pour avoir du debug sur une commande shell, laquelle ?

Là je tente d’exécuter ceci, je vois une fenêtre dos s'ouvrir mais si jamais les infos dont j'ai besoin s'affichent ici elle se ferme trop vite.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
 
Sub TU_SftpPut()
 
    Dim pUser As String
    Dim pPass As String
    Dim pHost As String
    Dim pRemotePath As String
    Dim fileToSendPath As String
    Dim Putty_pscp_path  As String
 
    Putty_pscp_path = "C:\toto\UtilitairesNecessaires\pscp.exe"
    fileToSendPath = "C:\toto\test.txt"
 
    pUser = "rzerze"
    pPass = "zerydfg"
    pHost = "ftp.rzarerzerze.fr"
    pRemotePath = "/home/rzarerzerze/www/test/"
 
    SftpPut Putty_pscp_path , fileToSendPath, pUser, pPass, pHost, pRemotePath
 
    MsgBox "Upload terminé !", vbInformation
 
End Sub
 
Public Sub SftpPut(Putty_pscp_path As String, fileToSendPath As String, pUser As String, pPass As String, pHost As String, pRemotePath As String)
    Dim strCommand As String
    Dim resultShell As Double
 
    Dim wsh As Object
    Set wsh = VBA.CreateObject("WScript.Shell")
    Dim errorCode As Long
    Dim waitOnReturn As Boolean: waitOnReturn = True
 
 
 
    strCommand = Putty_pscp_path & " -sftp -l " & pUser & " -pw " & pPass & _
        " " & fileToSendPath & " " & pHost & ":" & pRemotePath
 
    Debug.Print strCommand
 
 
    errorCode = wsh.Run(strCommand, vbNormalFocus, waitOnReturn)
 
If errorCode = 0 Then
    MsgBox "Done! No error to report."
    Set wsh = Nothing
Else
    MsgBox "Program exited with error code " & errorCode & "."
    Set wsh = Nothing
End If
End Sub
J'ai tenté d'ajouté un saut de ligne + pause, read ou sleep à la fin de la commande mais ça ne change rien.
Je pourrais surement mettre cette pause dans un fichier batch mais je pars du principe qu'il y a forcément moyen de débugger avec une simple commande comme ça vu que personne ne peut bosser à l'aveugle.

Merci