03-11-2020 01:20 PM
I need to send scp as a command through system exec.vi.
If I open up command prompt and type scp it works fine.
If I hit the windows key and type run then type cmd.exe "/k scp" it works just fine as well
When I put cmd.exe "/k scp" in the Command Line input for System Exec.vi it returns 'scp"' is not recognized as an internal or external command,
operable program or batch file.
Any reason why this is different? I was always under the assumption that if you can type it in Run then it should work just fine in the Command Line input.
Thoughts?
Thanks,
Solved! Go to Solution.
03-11-2020 01:45 PM
Try:
cmd /k scp
03-11-2020 01:51 PM - edited 03-11-2020 01:52 PM
I've tried every combination of quotes and non-quotes. I've also tried batch file. No dice.
My guess is application spacing issue?
Thanks,
03-11-2020 02:24 PM
when I type scp in a cmd prompt, I get a usage msg warning...
Also, I believe the issue you are having is that you are not in the correct directory. Try including the full path to the exe in the system exec.
Alternatively, you could set the working directory to the scp exe path.
03-11-2020 02:42 PM
Directory doesn't matter. Also, I can't start in the same directory as the executable because for some reason it gets installed in a different location on every PC when you install SSH.
My question really is: Why does it work from Run but not from System Exec.vi?
Thanks for the response.
03-11-2020 05:05 PM
I'm pretty sure you have to include the path.
03-11-2020 05:15 PM
Since the response says "not recognized as an internal or external command" indicates that the command cannot be found which would imply that the PATH environment variable is somehow different in LabVIEW vs Windows. Hence my suggestion about supplying the full path to your install of scp.
I have no further ideas. Sorry.
03-11-2020 10:11 PM - edited 03-11-2020 10:15 PM
The path I have scp installed at is "C:\Windows\System32\OpenSSH\scp.exe".
I initially noticed that this was part of the system path, but not my user path, so I tried adding it to my user path and restarting LabVIEW. No dice.
Using "cmd /c echo %PATH%" did show me a path including the OpenSSH directory though...
Setting the working directory to C:\Windows\System32\OpenSSH gave me a new error - 267. Some googling tells me this indicates an invalid directory... peculiar, because it's obviously there. Lots of the links talk about running a process as another user (perhaps LabVIEW is doing something like this?)
Copying the scp.exe to my desktop and setting the working directory there produced the expected output for cmd /s /c "scp /?". The /s is presumably doing nothing in this simple case.
You said your exe installs to different locations on different computers - does it work with any? Are they all in System32?
If they are, I'd strongly suggest checking this: Command Not Recognized When Using System Exec VI (even if not, it's worth a look). This talks about the mapping done by Windows when running a 32-bit process (e.g. LabVIEW 32-bit) on a 64-bit OS with regards to system directories.
Following the guidance there, I got the response expected from a working directory of "." and command cmd /c C:\Windows\Sysnative\OpenSSH\scp /?. (but you still need the path).
03-12-2020 11:21 AM
Thank you cbutcher. That did the trick. I had stumbled upon that in stack overflow for batch files but wasn't sure how to apply it to sysexec.
We will just force OpenSSH to be installed on our deployed machines. Then we can use this path.
Regards,
04-12-2022 08:55 AM
Hi Jigg,
did you use it for TestStand?
If yes, did you have some trouble with the password?
Because my usecase is "only" reading a file from a linux-system to my TestStand-Windows based environment.
CMD TX: scp username@ipaddress:/home/hello.txt c:\temp\world.txt
CMD RX: username@ipaddress's password:
CMD TX: sending the password (as line or append \n) then on RX side nothing happens. - quite bad....
Best regards
Juergen