Not getting exit from WinSCP prompt

Advertisement

shiyasm.in
Joined:
Posts:
3
Location:
Bangalore

Not getting exit from WinSCP prompt

Hi

I am transferring 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

Reply with quote

Advertisement

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

Re: Not getting exit from winscp prompt

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:
Opening session using command-line parameter in scripting is deprecated. Use 'open' command instead.
Searching for host...
Host "exit" does not exist.

Reply with quote

HarryDetroit
Guest

Not getting exit from winscp prompt

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.

Reply with quote

Advertisement

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

Re: Not getting exit from winscp prompt

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?

Reply with quote

HarryDetroit
Guest

Not getting exit from winscp prompt

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

Reply with quote

Advertisement

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

Re: Not getting exit from winscp prompt

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.

Reply with quote

Sharath
Joined:
Posts:
1
Location:
Banglore

Re: Not getting exit from winscp prompt

Hello am not able to exit from the WinSCP.
Even the exit command itself not taking.
If use the exit command before the put, it is working, but if I call the exit after the put it not getting out of the WinSCP.

Reply with quote E-mail

Advertisement

You can post new topics in this forum