New postlanzar winscp.com desde un .bat

Advertisement

sudanahi
Joined:
Posts:
2

lanzar winscp.com desde un .bat

Hola, estoy intentado lanzar un .bat que lo que hace es abrir la consola de winscp y traerse un fichero de una maquina al local de mi equipo pero no consigo hacerlo.Si lo hago manualmente a traves de la consola de windows(cmd) me sale correctamente pero en cambio si lo lanzo a través del .bat no funciona. El .bat contiene lo siguiente;

@echo off
echo open sftp://usuario:pasword@Ipmaquina:puerto/ -hostkey="ssh-rsa 1024 XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX" > prueba.tmp
echo lcd C:\Directorio >> prueba.tmp
echo cd directorio >> prueba.tmp
echo get fichero.txt >> prueba.tmp
echo exit >> prueba.tmp

WinSCP.com /script= prueba.tmp
pause

Reply with quote

Advertisement

sudanahi
Joined:
Posts:
2

Problems launching winscp

Hi, I'm trying to launch a .bat that it does is open the console winscp and bring a file from one machine to the place of my computer but I can not do it manually hacerlo.Si through the windows console (cmd) me but instead come out correctly if released through the .bat does not work. The .bat contains the following;

echo off
open cast sftp: // user: pasword @ Ipmaquina: port / -hostkey = "ssh-rsa 1024 XX: XX: XX: XX: XX: XX: XX: XX: XX: XX: XX: XX: XX: XX: XX: XX "> prueba.tmp
Echo lcd C: \ Directory >> prueba.tmp
Echo cd directory >> prueba.tmp
Echo get file.txt >> prueba.tmp
echo exit >> prueba.tmp

WinSCP.com / script = prueba.tmp
pause

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
33,005
Location:
Prague, Czechia

Re: Problems launching winscp

sudanahi wrote:

open cast sftp: // user: pasword @ Ipmaquina: port / -hostkey = "ssh-rsa 1024 XX: XX: XX: XX: XX: XX: XX: XX: XX: XX: XX: XX: XX: XX: XX: XX "> prueba.tmp
This should probably be:
echo open sftp://user@password@Ipmaquina:port/ -hostkey="ssh-rsa 1024 XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX" > prueba.tmp
I.e. you are missing an echo. Not sure what the cast was supposed to do. And you need to avoid all those spaces.

Reply with quote

Advertisement

You can post new topics in this forum