request about scp command (QProcess) using qt
-
@hlowd said in request about scp command (QProcess) using qt:
listArguments << "D:\SVN\Work\test\a.ini user@192.168.1.250:\home\user\SW";
Is this really your real code?!
You again have single back-slashes.
And why do you use back-slashes for paths on Linux side?
Also that line should be:listArguments << "D:\\SVN\\Work\\test\\a.ini" << "user@192.168.1.250:/home/user/SW/";
And please format you code properly.
-
@hlowd said in request about scp command (QProcess) using qt:
I entered two words in the post, but only one is displayed on the screen...
Use code tags properly, then it will be shown correctly
-
@hlowd said in request about scp command (QProcess) using qt:
but the readOutput function is not called
Probably because you're deleting m_process right after waitForFinished.
Are you sure scp.exe command is found?
Try with an absolute path to scp.exe to make sure it is actually found. -
@hlowd
There are files in that path.C:\Windows\WinSxS\amd64_openssh-common-components-onecore_31bf3856ad364e35_10.0.22621.1_none_1e3c4880a37d88bb scp.exe ssh-add.exe ssh-agent.exe ssh-keygen.exe
// new code
QString strParam = "C:\\Windows\\WinSxS\\amd64_openssh-common-components-onecore_31bf3856ad364e35_10.0.22621.1_none_1e3c4880a37d88bb\\scp.exe";
// error message
"CreateProcessW failed error:2 posix_spawn: No such file or directory"
-
@hlowd
If you want help on this, at least for my part, please make the effort to enclose your code blocks and literal extracts in the forums block quotes (</>
button) as we have asked several times. It does not require much effort on your side.By now you should be trying a command of
scp
, nothing else, no arguments, to verify that (a) it is found and can be run and (b) you can successfully read any output from it, e.g. presumably a "usage" message in this case. -
@hlowd said in request about scp command (QProcess) using qt:
Can I do it this way?
Yes, just try.
I would also execute scp using this absolute path in a terminal to make sure it works. -
There are files in that path.
C:\Windows\WinSxS\amd64_openssh-common-components-onecore_31bf3856ad364e35_10.0.22621.1_none_1e3c4880a37d88bb scp.exe ssh-add.exe ssh-agent.exe ssh-keygen.exe
// new code
QString strParam = "C:\\Windows\\WinSxS\\amd64_openssh-common-components-onecore_31bf3856ad364e35_10.0.22621.1_none_1e3c4880a37d88bb\\scp.exe";
// error message
"CreateProcessW failed error:2 posix_spawn: No such file or directory"
The same error occurs in the command prompt.
-
@hlowd Did scp executable ever work for you in terminal? The path where it is located looks strange, don't know from where it comes. On my machine I have it here: c:\windows\System32\OpenSSH\scp.exe
You can check where your scp.exe is located using this command:
where scp
-
@hlowd said in request about scp command (QProcess) using qt:
The scp.exe file exists in that path
Does it work with this path?
-
@hlowd
This really should not be too difficult to diagnose, if you stick to what is suggested and report behaviour.First try both of
scp \full\path\to\scp
in a Command Prompt. I assume at least one "works", and produces a "usage" output message?
Whichever produces the message, now try from a Qt program
QProcess proc; proc.start("....."); // here try whichever worked in Command Prompt qDebug() << proc.waitForFinished(); qDebug() << proc.readAll();
and report output.
-
it works(data is output)
- output 1 : true
- output 2 : "\r\nWindows IP ....."
QProcess proc; proc.start("ipconfig /all"); qDebug() << "output 1 : " << proc.waitForFinished(); qDebug() << "output 2 : " << proc.readAll();
do not Working
- output 1 : false
- output 2 : ""
QProcess proc; proc.start("scp C:\\Users\\user\\a.ini user@192.168.1.250:/home/user/SW/"); qDebug() << "output 1 : " << proc.waitForFinished(); qDebug() << "output 2 : " << proc.readAll();
this is also do not working
- output 1 : false
- output 2 : ""
QProcess proc; proc.start("C:\\Windows\\System32\\OpenSSH\\scp.exe C:\\Users\\user\\a.ini user@192.168.1.250:/home/user/SW/"); qDebug() << "output 1 : " << proc.waitForFinished(); qDebug() << "output 2 : " << proc.readAll();