With the Ubuntu subshell installed in Windows 10 Home, and IF you've installed sshpass (which doesn't come preinstalled in Ubuntu), then it's possible to SFTP files using a batch file!
There are 3 files in the series:
We begin our journey with the DOS batch file. [Note: I added the prompt and user input just so I could see what was on my screen at the end of the batch. Hey, remove it if it bugs you!]. The 2nd line calls the Ubuntu bash shell from Windows.
Next comes the Linux bash shell script called from the DOS batch file, above. In this example, the (freshly) installed sshpass starts the sftp session, loging on to server.com using the password password1 and the User ID of me. It also looks for sftp commands in the next file in the series, sftp.cmd.
#!/bin/bash sshpass -p password1 sftp -oBatchMode=no -b sftp.cmd firstname.lastname@example.org
In the following SFTP command batch file, SFTP will change directories. On my system, the database files are read-only, so I have to chmod the directories and files. SFTP doesn't understand the "-r" option for chmod, so I have to do it one directory at a time. [Sorry - GeSHi doesn't know ftp or sftp commands, so the syntax highlighting adheres to bash - I like the pretty colors!]. I add a lot of pwd and ls commands so I can see what's happening - remove them if they bug you!
cd db.server.com/dbs pwd ls -l chmod 755 gva cd gva chmod 755 gva* pwd ls -l lcd ../dbs lpwd lls -l put gva*.db chmod 555 * pwd ls -l cd .. chmod 555 * pwd ls -l