dle Posted November 13, 2014 Share Posted November 13, 2014 Can I do SCP upload using DF? Link to comment Share on other sites More sharing options...
AzeoTech Posted November 13, 2014 Share Posted November 13, 2014 No, but you could find a command line SCP tool and then use System.shellExecute() to trigger it. Link to comment Share on other sites More sharing options...
dle Posted November 19, 2014 Author Share Posted November 19, 2014 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 system.ShellExecute("C:\Windows\System32\cmd.exe","open","C:\Test\pscp.exe","","show") The command above will open the windows command line but won execute the pscp.exe. Link to comment Share on other sites More sharing options...
AzeoTech Posted November 19, 2014 Share Posted November 19, 2014 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 More sharing options...
dle Posted November 19, 2014 Author Share Posted November 19, 2014 Can you show me how to pass multiple parameters. I'm trying to trigger and send a command to a tool called Putty.exe System.Shellexecute("C:\Putty.exe","open","username@10.0.0.100","","show") 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@10.0.0.100: /ps -A,"","show") but Putty wont open Link to comment Share on other sites More sharing options...
AzeoTech Posted November 19, 2014 Share Posted November 19, 2014 You have a typo. You moved the parameters outside the quotes. Link to comment Share on other sites More sharing options...
dle Posted November 20, 2014 Author Share Posted November 20, 2014 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@10.0.0.100 ps -A","","show") System.Shellexecute("C:\Test\Putty.exe","open","username@10.0.0.100 \\ps -A","","show") System.Shellexecute("C:\Test\Putty.exe","open","username@10.0.0.100 :\\ps -A","","show") ......... none of them working. Putty will confuse and see that the ip address will be 10.0.0.100 ps -A and so on. Link to comment Share on other sites More sharing options...
AzeoTech Posted November 20, 2014 Share Posted November 20, 2014 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@10.0.0.100 /ps -A Instead, you probably need: c:\test\putty.exe /ps -A username@10.0.0.100 Though I don't see a ps flag in the putty docs. Link to comment Share on other sites More sharing options...
dle Posted November 20, 2014 Author Share Posted November 20, 2014 I guess ps -A is a command within the server where putty connecting to. I did: system.shellexecute("C:\Putty.exe","open","-ssh username@10.0.0.100","","open") DF will open a putty command line session that showing putty successfully logging to username@10.0.0.100 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 More sharing options...
AzeoTech Posted November 20, 2014 Share Posted November 20, 2014 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.