I will give an example of a file transfer script via SFTP in Windows.
1) Install WinSCP
2) Connect to the host once so that the key gets into the cache.
3) Create a tftp.bat file with the contents:
@echo off CD "C:\Program Files (x86)\WinSCP" winscp.com /ini=nul /script=D:\test\script.txt
4) Create a script.txt, for example, with contents (the script copies the file D:\test\file1.txt to the server in the user’s home directory, and file2.txt downloads from the server):
option echo off option batch on option confirm off open sftp://ixnfo:email@example.com:22/ -hostkey="ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" lcd "D:\test\" put -nopermissions -nopreservetime "D:\test\file1.txt" "/home/ixnfo/" get "/home/ixnfo/file2.txt" "D:\test\" exit
To check, run the script from the Windows command line: