Unable to run winscp script from Java App

Advertisement

tmpuser
Guest

Unable to run winscp script from Java App

Unable to run winscp script from Java App code's process runtime.exec(cmd)

=> Application just hangs and does not execute the script.
(This same script runs from the command line successfully without error.)

I am using the latest WinSCP v4.2.3
cmd =
c:\program files\winscp3\winscp.com /script=scriptFile.txt /parameter \\path_to_remote_file\filename /log=logfile.xml

scriptFile.txt file =
option batch abort
option confirm off
open user:pswd@server
cd remote_path
option transfer binary
put -nopermissions %1%
close
exit

I have also tried this command in the Java App without the path as:
winscp.com /script=scriptfile.txt /parameter \\path_to_remote_file /log=logfile.xml
(My System Env variable PATH includes c:\program files\winscp3\ )
==> still hangs Java App

I have also tried this command in the Java App using winscp.exe command instead:
c:\program files\winscp3\winscp.exe /console /script=scriptFile.txt /parameter \\path_to_remote_file\filename /log=logfile.xml
==> Java App runs the command but the Winscp GUI display as if no script was provided.


Any suggestions on getting this to work via the Java App?

Thanks,
cwgd

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,454
Location:
Prague, Czechia

Re: Unable to run winscp script from Java App

Please post a full log file showing the problem.

To generate log file, enable logging, log in to your server and do the operation and only the operation that causes the error. For posting extensive logs you may use pastebin or similar application. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you may email it to me. You will find my address (if you log in) in my forum profile. Please include link back to this topic in your email. Also note in this topic that you have emailed the log.

Reply with quote

cwgd
Joined:
Posts:
1

Re: Unable to run winscp script from Java App

martin wrote:

Please post a full log file showing the problem.


I have used logs on the command line with success but not from the Java App.
The WINSCP command is not working from the Java App and therefore no log is generated. It seems that only the command itself is recognized by the app and not the rest of the line of information including the script and logfile.
Has anyone else been able to run this tool from a Java App?

Thanks,
cwgd

Reply with quote

BiBo
Guest

Re: Unable to run winscp script from Java App

Sorry for rising up such old post, but just in case if somebody else face this problem (as I did)...
I've got WinSCP runnig with /script parameter from Java this way:

Runtime.getRuntime().exec("cmd /c <full WinSCP file name> /script=<script filename>");

If I haven't used "cmd /c" script wasn't executed.
May be it will help somebody.

Reply with quote

Advertisement

You can post new topics in this forum