Scp Upload?


Recommended Posts

Does the system.Shellexecute() can pass the parameter to the command line?

I have an execute program that require to be open in a command prompt call pscp.exe




The command above will open the windows command line but won execute the pscp.exe.



Link to comment
Share on other sites

Technically shellExecute will run in a command prompt anyway.  But if you want to do it as you describe, I believe you need another flag, either /C if you want it to run and then the window close when its done, or /K if you don't want the window to close.  Go to a command prompt and type:


help cmd


and you can see all the flags.  Note that the flags would go in the same string as your "C:\Test\pscp.exe" and first, e.g.: "/C c:\Test\pscp.exe"

Link to comment
Share on other sites

Can you show me how to pass multiple parameters.

I'm trying to trigger and send a command to a tool called Putty.exe




I could get it open and logging  using the username and ip address. I need to execute a few more commands with that Putty.exe command line.


I trid

System.Shellexecute("C:\Putty.exe","open",username@ /ps -A,"","show")


but Putty wont open

Link to comment
Share on other sites

I just type it wrong when I post it.

I did try so many ways but still couldn't make it work.


System.Shellexecute("C:\Test\Putty.exe","open","username@ ps -A","","show")


System.Shellexecute("C:\Test\Putty.exe","open","username@ \\ps -A","","show")


System.Shellexecute("C:\Test\Putty.exe","open","username@ :\\ps -A","","show")



none of them working. Putty will confuse and see that the ip address will be ps -A  and so on.

Link to comment
Share on other sites

Usually the flags (i.e. stuff with slashes or dashes) have to be in front of the thing without flags.  This is true with just about any command line program, and has nothing to do with DAQFactory.  So try putting -A first.  In fact, test it at the command prompt.  I think you will find that this doesn't work at the command prompt (outside DAQFactory) even:


c:\test\putty.exe username@ /ps -A


Instead, you probably need:


c:\test\putty.exe /ps -A username@


Though I don't see a ps flag in the putty docs.  

Link to comment
Share on other sites

I guess ps -A is a command within the server where putty connecting to.


I did: system.shellexecute("C:\Putty.exe","open","-ssh username@","","open")


DF will open a putty command line session that showing putty successfully logging to username@ using SSH protocol.

Now, on that command line session, I type "ps -A", it will list all of the processes are running within the server, then I type "slay Product", the Product's process will be refreshed.


Is it possible for DF to execute the command  "slay Product" after putty successfully logging to the server?

Link to comment
Share on other sites

No, DF can't execute commands once the application is open.  Most likely you'll have to look in the docs for Putty and see if there is a way to, for example, provide a batch file that it runs.  I know the Windows command line FTP tool has this, so I'm guessing putty does too.  You also might be able to use the windows pipe command, though likely you'll have to use a .bat batch file along with a call to cmd.exe to trigger it.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.