3

I'm trying to automate file upload by creating .bat file which when run will upload files to SFTP server. I would like to automate this process, but sftp command line asks for password. Is there a way to enter the password in .bat file to automate it?

This is the code I'm using. It works, but user needs to enter the password. Is there a way to create batch file where password will be entered automatically?

sftp user@ip
password
put C:\Users\user\Desktop\folder\* /public_html/upload
Compo
  • 36,585
  • 5
  • 27
  • 39
David
  • 69
  • 1
  • 2
  • 7

1 Answers1

-1

I assume that you use (Win32-)OpenSSH sftp. It does not have any way to provide a password, on purpose.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
  • Links to answers don't really help anyone out. If this is a duplicate question it should be marked as such. – Anthony Nichols Feb 01 '23 at 16:47
  • @AnthonyNichols I do not think it is duplicate. The other question is about Linux, this is about Windows. And this question is actually pretty broad (while the OP was understandably not aware of that). That's why I believe that a list of alternative solutions with links to details is a good way to answer to the question. – Martin Prikryl Feb 01 '23 at 17:32