I can't assign files with batch file, it stays in the folder.

Advertisement

mhm.erdem@...
Guest

I can't assign files with batch file, it stays in the folder.

I want to transfer a file with private key with SFTP in WinSCP. I have no problem connecting with the user, but I cannot access the folder on the other side, no matter what I do, can you help with this?
I can manually transfer files through the application.
In addition, I can access the folder with cd / from WinSCP and transfer files manually with put.
option batch on
option confirm off
"C:\Program Files (x86)\WinSCP\winscp.com" /command "open sftp://xxx:xxxx@sftp.xxx.com:22 -hostkey="rsa-key-20210922" -privatekey="C:\app\xxx_private.ppk" -passphrase="xxxxx""
option transfer binary
cd /simple/millnet/xxx
put "C:\app\deneme.txt"
close
exit

winscp.JPG

Reply with quote

Advertisement

mhm.erdem@...
Guest

Re: I can't assign files with batch file, it stays in the folder.

Hello there,
Thank you for the return, but my problem does not have a solution in the given link. I'm connecting with the script, but I can't access the other party's folder and send with put. Script hangs in winscp.

Reply with quote

martin
Site Admin
martin avatar

Re: I can't assign files with batch file, it stays in the folder.

Please read the article carefully. You have that problem. Only the open command it correct. That's why you can connect, but the rest of your script is not processed.

Reply with quote

Guest

Re: I can't assign files with batch file, it stays in the folder.

So what should I write here if I want to proceed with the following command?
and key=""ssh-keysa is my ...""" I need enough processing from the evaluations in my pp file
winscp.com /command "open sftp://... -hostkey=""ssh-rsa ...""" "put ""C:\my file.dat"""
                    <-           Script command 1           -> <-  Script command 2  ->
PuTTY-User-Key-File-3: ssh-rsa
Encryption: aes256-cbc
Comment: rsa-key-20210917
Public-Lines: 6
AAAAB3NzaC1yc2EAAAADAQABAAABAQDoT0mVHaIHImVoOvto3EGw1mji/7Yu8Sgl
sY1o2/hpLvMR7yiz1fx8aBVbPz8XuSHQzW4InU3ZeViHa4wVP0uegV9kDMhKqkQn
lTdatKehw+jjOgVjxHgVwaTb53QwSglFYARVUWIR38Bu1wCXe9o0AHmYBaAegh80
QZ14MHWfmQHEbdToiGg3MwjW5SP917q/eaYqwSafz3gyC8hvlzrWcZQyL7y4+izU
1y38TR1liV2LXChCEmA7VFtrgS5oQCBknKCUaGK8yW6y07KYLHQKL8ZXPdfxSIez
yPWKTDYB2UgKXOBoXOOB2m+Pw7E1Zo70cGSZ5v6Yhsej3KJ15HQj

Reply with quote

Advertisement

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

Re: I can't assign files with batch file, it stays in the folder.

Just do what the article says:
"C:\Program Files (x86)\WinSCP\winscp.com" /command ^
    "open [rest of your open command]" ^
    "cd /simple/millnet/xxx" ^
    "put ""C:\app\deneme.txt""" ^
    "close" ^
    "exit" ^
Or put all commands on a single line or even better to a separate script file, if the batch syntax is too complex.

Reply with quote

Guest

Re: I can't assign files with batch file, it stays in the folder.

Thank you for your support, the transaction was successful.

Reply with quote

Advertisement

You can post new topics in this forum