Topic "Auto login to WINSCP to download a file"

Author Message
Merit

Guest


Need help on this- By executing/running the bat file, it should connect to winscp and download the file to my local system. It should not ask any user Id and password

I have tried in two ways. But no luck. Please help on this.
=======
Case1
=======
By executing the below "Cmd-Txt.bat" file data is downloading but asking userid and password, even though I have mentioned those details in "original.TXT" file(There is no special characters in the password. It contains only alphabets and numeric values only).

Cmd-Txt.Bat file:
====================
cd /d C:\Program Files (x86)\WinSCP
winscp.exe /console /script=C:\Users\VJAYAKRI\Desktop\original.txt
exit
CMD

original.TXT
================
open mysite.com
USEDID
Password
lcd C:\
cd <<directery name where the file is located in mysite.com>>
get <<FileNameToFetch>>.TXT C:\<<DestinationFileName>>.txt
bye

By executing/running the Cmd-Txt.Bat file, it is prompting for use Id and password. Once i have input those details the file is downloaded the file to my local system.
==========================================================================
========
Case 2
========
By executing the below ftp-pull.bat file, it is connecting to winscp without asking the userid and password but file is not downloading.

ftp-pull.bat
============
cd /d C:\Program Files (x86)\WinSCP
winscp ftp://<<USERiD>>:<<PASSWORD>>@MYSITE.com/<<directery name where the file is located in mysite.com>> /explicitssl
get <<FileNameToFetch>>.TXT C:\<<DestinationFileName>>.txt
exit
CMD

By ecevuting the ftp-pull.bat, I am getting the below message in the command line console.
===============================================================
Connecting to MYSITE.com...
Connected with MYSITE.com,negotiatinf SSL connection...
SSL connection established. Waiting for welcome messae...
Connected
Starting the session...
Reading the session...
Session started.
Active session:[1] <<user Id>>@<<mysite>>.com
Winscp>
===============================================================


It is connecting to Winscp with out asking the user Id and password. But the get command is not exectuning it seems, So file is not downloading.


Need your help very urgently to resolve this to download the file through winscp with out giving the use id password manually.
please post on this or reach me on my mail id smeritv@gmail.com, for more details.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Merit wrote:
open mysite.com
USEDID
Password
lcd C:\
cd <<directery name where the file is located in mysite.com>>
get <<FileNameToFetch>>.TXT C:\<<DestinationFileName>>.txt
bye

You cannot specify username and password on separate lines in the script. You have to insert them to session URL. You should also indicate a protocol.

E.g. open ftp://USEDID:Password@mysite.com.

See
http://winscp.net/eng/docs/scriptcommand_open
http://winscp.net/eng/docs/session_url

Quote:
cd /d C:\Program Files (x86)\WinSCP
winscp ftp://<<USERiD>>:<<PASSWORD>>@MYSITE.com/<<directery name where the file is located in mysite.com>> /explicitssl
get <<FileNameToFetch>>.TXT C:\<<DestinationFileName>>.txt
exit
CMD

You cannot combine WinSCP and Windows commands in a single file.

In both cases you seem to try to put inputs that you typed onto console into a file. But note that in neither case you are using the file as a source for redirected standard input (what wouldn't work anyway), but as a script files that have a different semantics.
Merit

Guest


Then, How can I download the file. Much appreciated If you provide complete script.


prikryl wrote:
Merit wrote:
open mysite.com
USEDID
Password
lcd C:\
cd <<directery name where the file is located in mysite.com>>
get <<FileNameToFetch>>.TXT C:\<<DestinationFileName>>.txt
bye

You cannot specify username and password on separate lines in the script. You have to insert them to session URL. You should also indicate a protocol.

E.g. open ftp://USEDID:Password@mysite.com.

See
http://winscp.net/eng/docs/scriptcommand_open
http://winscp.net/eng/docs/session_url

Quote:
cd /d C:\Program Files (x86)\WinSCP
winscp ftp://<<USERiD>>:<<PASSWORD>>@MYSITE.com/<<directery name where the file is located in mysite.com>> /explicitssl
get <<FileNameToFetch>>.TXT C:\<<DestinationFileName>>.txt
exit
CMD

You cannot combine WinSCP and Windows commands in a single file.

In both cases you seem to try to put inputs that you typed onto console into a file. But note that in neither case you are using the file as a source for redirected standard input (what wouldn't work anyway), but as a script files that have a different semantics.
Guest




It's working with the below code.

===========================================================================================
cmd-txt.bat
=============
cd /d C:\Program Files (x86)\WinSCP
winscp.exe /console /script=C:\Users\original.txt
exit
CMD

original.txt
=============
open ftp://<<UserName>>:<<password>>@<<mysite>>.com -explicitssl
get <<YouFileName>>.TXT <<DestinationLocation>>\<<NewFileName>>.txt
bye

===========================================================================================

Thanks

Merit wrote:
Then, How can I download the file. Much appreciated If you provide complete script.


prikryl wrote:
Merit wrote:
open mysite.com
USEDID
Password
lcd C:\
cd <<directery name where the file is located in mysite.com>>
get <<FileNameToFetch>>.TXT C:\<<DestinationFileName>>.txt
bye

You cannot specify username and password on separate lines in the script. You have to insert them to session URL. You should also indicate a protocol.

E.g. open ftp://USEDID:Password@mysite.com.

See
http://winscp.net/eng/docs/scriptcommand_open
http://winscp.net/eng/docs/session_url

Quote:
cd /d C:\Program Files (x86)\WinSCP
winscp ftp://<<USERiD>>:<<PASSWORD>>@MYSITE.com/<<directery name where the file is located in mysite.com>> /explicitssl
get <<FileNameToFetch>>.TXT C:\<<DestinationFileName>>.txt
exit
CMD

You cannot combine WinSCP and Windows commands in a single file.

In both cases you seem to try to put inputs that you typed onto console into a file. But note that in neither case you are using the file as a source for redirected standard input (what wouldn't work anyway), but as a script files that have a different semantics.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Anonymous wrote:
It's working with the below code.

===========================================================================================
cmd-txt.bat
=============
cd /d C:\Program Files (x86)\WinSCP
winscp.exe /console /script=C:\Users\original.txt
exit
CMD

That's correct. I'd just recommend you use winscp.com instead of winscp.exe /console to avoid an additional console window from opening.

winscp.com /script=C:\Users\original.txt

See http://winscp.net/eng/docs/executables
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License