Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

optimus

Re: Execute WinSCP from a batch file

quickdeveloper wrote:

Thanks Martin,i checked it.

I have used C# with WinSCP dll and accomplished the task.

I realized it's much easier and faster that way in terms of exception handling :D

Thanks!

can u share the code
Mark9999

can winscp.com select query to linux-mysql database?

can winscp.com select query to linux-mysql database?
martin

Re: Winscp from bat file

I'm sorry, but I do not understand your response.

I have asked: What did you try to get the logs?
Guest

Re: Winscp from bat file

martin wrote:

What did you try to get the logs?

Nothing was in the logs. My xp_cmdshell query just runs...the same issue you reported experiencing.
martin

Re: Winscp from bat file

Did you ever resolve this issue? I am experiencing the same issue - no log files to give me a hint at the problem.

What did you try to get the logs?
Guest

Re: Winscp from bat file

Prasadhello wrote:

I am trying to run winscp from bat file and with xp_cmdshell in sql server. However when I run it keeps running forever. I have put exit in bat file. Anybody aware of this issue?

Also is there any way to capture winscp dir results in sql server table or like normal result set instead of XML.

Did you ever resolve this issue? I am experiencing the same issue - no log files to give me a hint at the problem.

How did you resolve this issue??
Madhu

Scripting Public key authentication passphrase

Hi

I am trying to get file using SFTP. My set up was authentication with public key Passphrase.

Here is my script file name getfile.txt
open xxxxxx (site already stored with host name, port and username)
passphrase
get *.txt to c:\*.txt
Close
exit

Created download.bat file as follows:
@echo off
winscp.com /script=getfile.txt

both the files are saved at WinSCP folder.

When download.bat file run, the script did not take Passphrase as per second line and come out without further execution.
Can anyone help how input Passphrase.

Thanks
Madhu
martin

Re: send file to sftp server

Fairfielder wrote:

I don't understand. On the following page it shows this example batch file, which combines WinSCP and Windows commands:
https://winscp.net/eng/docs/guide_automation

There's no WinSCP command it that batch file. The WinSCP commands are in example.txt.
Fairfielder

Re: send file to sftp server

I don't understand. On the following page it shows this example batch file, which combines WinSCP and Windows commands:
https://winscp.net/eng/docs/guide_automation

Here's the example batch file:
winscp.com /script=example.txt
if %ERRORLEVEL% neq 0 goto error
 
echo Success
sendmail.exe -t < success_mail.txt
exit 0
 
:error
echo Error!
sendmail.exe -t < error_mail.txt
exit 1
Mahmoud

send file to sftp server

Hi all,

I did the following batch file to send file to sftp server, but the put command (or any commands) after sftp session opeded didn't work:
cd C:\Program Files\prog1\output1
WinSCP.exe username@x.x.x.x/example/test
put %file%
close
exit

can any one help?

thanks
martin

Re: Winscp from bat file

Prasadhello wrote:

I am trying to run winscp from bat file and with xp_cmdshell in sql server. However when I run it keeps running forever. I have put exit in bat file. Anybody aware of this issue?

Please start a new thread and attach a full log file showing the problem (using the latest version of WinSCP).

To generate log file, use /log=path_to_log_file command-line argument. Submit the log with your post as an attachment. 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.
Prasadhello

Winscp from bat file

I am trying to run winscp from bat file and with xp_cmdshell in sql server. However when I run it keeps running forever. I have put exit in bat file. Anybody aware of this issue?

Also is there any way to capture winscp dir results in sql server table or like normal result set instead of XML.
atchere

Re: Execute WinSCP from a batch file

Question I am having trouble getting WINSCP to take a password in the batch mode what is the correct syntex to make this happen

atc
quickdeveloper

Execute WinSCP from a batch file

Thanks Martin,i checked it.

I have used C# with WinSCP dll and accomplished the task.

I realized it's much easier and faster that way in terms of exception handling :D

Thanks!
quickdeveloper

WinSCP from batch file

Please also note that i am using winscp.com to redirect the output to a text file.

The only other option would be to open a new winscp session in each command line of batch file which involves more cost.
Quickdeveloper

Execute WinSCP from a batch file

Hi

I want to execute winscp script from a batch file.

Assume the following contents are in C:\MYFILE.BAT
echo " OPENING THE SESSION "
winscp.com /console /command:"open xyz:abc@ipaddress"
echo "CONNECTED TO THE VM "
 
REM   delete old files
rm file1.tar

when I run C:\>MYFILE.BAT, I am able to connect to unix vm, however it goes into shell mode and second command (deleting file1.tar won't get executed). do we need to give any other parameter?

I know we can execute batchfile itself from winscp directory (eg: winscp.com /script:filename.bat) but in that case i can't check errors with if/ else conditions in batch file since winscp doesn't recognise the if/else.

Any suggestions please? i don't want to use xml logging as it looks too complicated for my use.


Thanks