commands work in console but not from .bat file

Advertisement

Botany.Support
Guest

commands work in console but not from .bat file

Hello

I am using winscp.com and winscp.exe version 4.1.9 build 416 on a Windows 2003 server. The software is installed to c:\program files\winscp. The batch file that runs the commands is located in the same folder. I am getting files from a RedHat box on the same subnet. I started with winscp.exe and created a saved session with password for the remote Redhat server. The session named mfgelnz has the option file protocol SFTP with SCP fallback. I imported the SSH key as well so winscp can start the session without prompting for password or to accept keys.

I can then run winscp.com and type the commands one by one which works fine. Running from a batch file in a dos window from the installed folder does not work. The error is "Host does not exist". Output below is from the dos window on the windows 2003 server.


C:\Program Files\Winscp>winscp-nz.bat

C:\Program Files\Winscp>winscp.com \command "option batch on" "option confirm of
f" "option transfer binary" "open mfgelnz" "synchronise D:\QADBACKUP\Live /dr04
/dr05-symdir/Qadbackup/QAD2008SE/Live" "exit"
Searching for host...

Host does not exist
winscp> exit

C:\Program Files\Winscp>edit winscp-nz.bat

C:\PROGRA~1\Winscp>winscp.com
winscp> open mfgelnz
Searching for host...
Connecting to host...
Authenticating...
Using username "root".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Reading remote directory...
Session started.
Active session: [1] mfgelnz
winscp> exit

C:\PROGRA~1\Winscp>winscp-nz

C:\PROGRA~1\Winscp>winscp.com \command "option batch on" "option confirm off" "
option transfer binary" "open mfgelnz" "synchronise D:\QADBACKUP\Live /dr04/dr05
-symdir/Qadbackup/QAD2008SE/Live" "exit"
Searching for host...

Host does not exist
winscp> exit

C:\PROGRA~1\Winscp>winscp-nz

C:\PROGRA~1\Winscp>winscp.com \command "open mfgelnz" "option batch on" "option
confirm off" "option transfer binary" "synchronise D:\QADBACKUP\Live /dr04/dr05
-symdir/Qadbackup/QAD2008SE/Live" "exit"
Searching for host...

Host does not exist
winscp> open mfgelnz
Searching for host...
Connecting to host...
Authenticating...
Using username "root".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Reading remote directory...
Session started.
Active session: [1] mfgelnz
winscp> option batch on
batch on
winscp> option confirm off
confirm off
winscp> option transfer binary
transfer binary
winscp> synchronize local D:\qadbackup\live /dr04/dr05-symdir/Qadbackup/QAD2008S
E/Live
Comparing...
Local 'D:\qadbackup\live' <= Remote '/dr04/dr05-symdir/Qadbackup/QAD2008SE/Live'

Synchronizing...
Local 'D:\qadbackup\live' <= Remote '/dr04/dr05-symdir/Qadbackup/QAD2008SE/Live'

q2008live.bkp2 | 799958 KiB | 1551.8 KiB/s | binary | 100%
q2008live.bkp3 | 799958 KiB | 1553.6 KiB/s | binary | 100%
q2008live.bkp4 | 2998 KiB | 1524.4 KiB/s | binary | 100%
q2008live.st | 6 KiB | 1482.1 KiB/s | binary | 100%
winscp> exit

C:\PROGRA~1\Winscp>

Reply with quote

Advertisement

botany.support
Guest

thanks for that

yes, the batch file now works. Next step is to run it thru the windows scheduler. Cheers Prikryl.

Reply with quote

Advertisement

You can post new topics in this forum