Topic "Not getting exit from winscp prompt"

Author Message
shiyasm.in
[View user's profile]

Joined: 2014-03-18
Posts: 3
Location: Bangalore
Hi

I am trasnferring files from windows xp to linux machine using winscp through a windows batch script. Once the transfer completes the batch code should get execute. But After the transfer it is not coming out of the winscp prompt at all. I try to give an extra exit in the batch code that will totally come out of the session. Seems like the exit in winscp command is not working properly.I am using same kind of code in another machine which windows 7 What could be the issue. Below please find the code. I am using Winscp 4.2.3 build 494.

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

WinSCP /command "option batch continue" "option confirm off" "open HPAY_UAT" "lcd D:\DSC_TRANS\FILES\" "cd /home/oracle/dsc_files/" "put 3.TIFF /home/oracle/dsc_files/" /log="D:\DSC_TRANS\LOGS\3.TIFF.log" "exit"

exit

findstr /C:"to remote directory finished" D:\DSC_TRANS\LOGS\3.TIFF.log
if %errorlevel%==0
(
echo update SHIYAS.EPSF_REMB_TIFF_STORE_PATH set STATUS_C= 'D' where STATUS_C= 'S' and Filename_C='3.TIFF'; >> D:\DSC_TRANS\UPDATE_TAB\update_test.sql
echo commit; >> D:\DSC_TRANS\UPDATE_TAB\update_test.sql
echo exit >> D:\DSC_TRANS\UPDATE_TAB\update_test.sql
echo sqlplus shiyas/shiyas123@UAT @D:\DSC_TRANS\UPDATE_TAB\update_test.sql > D:\DSC_TRANS\UPDATE_TAB\update_tab.bat
call D:\DSC_TRANS\UPDATE_TAB\update_tab.bat
)
exit

=============================================
Below please find the output of running the batch script.

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

C:\Documents and Settings\a160559\Desktop>
C:\Documents and Settings\a160559\Desktop>Tran_3

C:\Documents and Settings\a160559\Desktop>WinSCP /command "option batch continue" "option confirm off" "open HPAY_UAT" "
lcd D:\DSC_TRANS\FILES\" "cd /home/oracle/dsc_files/" "put 3.TIFF /home/oracle/dsc_files/" /log="D:\DSC_TRANS\LOGS\3.TIF
F.log" "exit"
Searching for host...
Host does not exist
batch continue
confirm off
Searching for host...
Connecting to host...
Authenticating...
Using username "oracle".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Reading remote directory...
Session started.
Active session: [1] HPAY_UAT
D:\DSC_TRANS\FILES
/home/oracle/dsc_files
3.TIFF | 0 KiB | 0.0 KiB/s | binary | 100%
winscp>
winscp>
winscp>

===========================================
Above the control is not getting released from winscp prompt.

Please help me on this.

Thanks
SHIYAS M
Advertisements
shiyasm.in
[View user's profile]

Joined: 2014-03-18
Posts: 3
Location: Bangalore
can I get any update on this issue.

Thanks
SHIYAS M
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
You have to put the exit command in the command list after the /command switch. Not after the /log switch.

This way, WinSCP interprets the exit as standalone command-line argument, what is a deprecated syntax to open session/host "exit". That's why you get the "Host does not exist" at the beginning of the output.

Had you been using the latest version of WinSCP (what you should), you would get more info:
Quote:
Opening session using command-line parameter in scripting is deprecated. Use 'open' command instead.
Searching for host...
Host "exit" does not exist.
shiyasm.in
[View user's profile]

Joined: 2014-03-18
Posts: 3
Location: Bangalore
That worked. Thanks a lot.

SHIYAS M
HarryDetroit

Guest


Hi
I am trying to exit from winscp in a batch file to to do other activity . It is not not coming out and still stays like winscp>. I am trying to send files through ftp from windows to UNIX MACHINE.

"C:\Program Files (x86)\WinSCP\winscp.com" /command ^
"option batch abort" ^
"option reconnecttime off" ^
"open ftp://tsqasb1:TSQASB1@cw09.compuware.com:21 -rawsettings SendBuf=0 Compression=1 -timeout=999" ^
"cd /u/tjp/Harish/CESInstall"^
"binary"^
"put ""\\ddd-netaff1\Boerpps01\vdev\CEES\Build\trunk\archive\%%a\USS\cpwr\USS\install.jar"" ./"^
"exit"

Anybody can help on real quick.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
HarryDetroit wrote:
Hi
I am trying to exit from winscp in a batch file to to do other activity . It is not not coming out and still stays like winscp>. I am trying to send files through ftp from windows to UNIX MACHINE.

"C:\Program Files (x86)\WinSCP\winscp.com" /command ^
"option batch abort" ^
"option reconnecttime off" ^
"open ftp://tsqasb1:TSQASB1@cw09.compuware.com:21 -rawsettings SendBuf=0 Compression=1 -timeout=999" ^
"cd /u/tjp/Harish/CESInstall"^
"binary"^
"put ""\\ddd-netaff1\Boerpps01\vdev\CEES\Build\trunk\archive\%%a\USS\cpwr\USS\install.jar"" ./"^
"exit"

Anybody can help on real quick.

Your code looks ok. Show us a screenshot of the problem.
HarryDetroit

Guest


See the attached Image . Please help me on this . I have latest WinSCP and getting this issue most of the time.
WinSCpError.png (15.21 KB)

Description: (none)

WinSCpError.png

martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
HarryDetroit wrote:
most of the time.

Most of the time or all the time?

There must be some small mistake in your batch file (like a misplaced space) that cannot be seen in the post.
Can you post your batch file as an attachment to avoid any formatting changes when posting?
HarryDetroit

Guest


Find the Batch file in attachment.
TEST.bat (584 Bytes) Private file

Description: (none)

TEST.bat (584 Bytes) Private file

Description: (none)

martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
Your batch file works for me as expected.

Please, add logging and attach the log.

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 can mark the attachment as private.
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