Respond y(es) to pscp host key prompt in vc++(How do I skip the Store key in cache? (y/n, Return cancels connection, i for more info) first time)

Raghav 21 Reputation points
2023-07-13T10:38:42.55+00:00

we are using "pscp -scp -P 22 -pw mypassword "file.cfg" root@192.168.1.123:/filesys/net/provisioned/ < output.txt"

Here we Create a text file (output.txt) with the letter Y and a carriage return in it using CreatProcess function. But still its not working, getting "More than one remote source not supported" when copying files via pscp. Even we tried to use "echo y |" as well as "type y |" and -batch also. These commands are working fine through the command prompt through the vc++ code does not work for the first time. How do I skip the Store key in cache? (y/n, Return cancels connection, i for more info) first time.

Note: pscp.exe copied in current directory.

Thanks in advance

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,637 questions
{count} votes

Accepted answer
  1. Viorel 114.7K Reputation points
    2023-07-13T13:08:15.6166667+00:00

    Did you try something like this?

    char s[] = "cmd /C echo Y | pscp -scp -P 22 -pw mypassword \"file.cfg\" root@192.168.1.123:/filesys/net/provisioned/";
    
    CreateProcess( NULL, s, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi );
    

    Maybe you should show some details.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful