Use batch processing on Windows to copy files from a remote Linux server to a local
################################################
Install Cygwin to select the following installation package:
Autoconf2. , automake1.1, Binutil, Gcc-cor,
Gcc-g, GD, Pcre, Pcre-devel, make, vim,expect (expect is required to enter the password automatically when using SCP)
Image file Selection: Http://cygwin.mirror.globo.tech
#################################################
1. Setting the Windows System environment variables
Add/cygwin64/home/admin;/cygwin64/bin to the front of the Windows System environment variable path
2, in the/cygwin64/home/admin script 101.sh, the content is as follows:
#!/bin/expect-f
#set Password 123456
Set date [exec date-d "-2 Day" "+%y%m%d"]
Set FD [Open/home/admin/passwd.txt R]
Set password [Read $FD]
Close $FD
Spawn Scp-r [Email protected]:/tmp/nagiosa_${date}.tar/home/admin/log/
Set Timeout 300
Expect "[email protected] ' s password:"
Set Timeout 300
Send "$password \ r"
Set Timeout 300
Send "exit\r"
Expect EOF
3. password file
Vi/home/admin/passwd.txt
123456
4, write the batch file 101.bat on Windows, the content is as follows:
Expect-f c:\cygwin64\home\admin\101.sh
Expect-f c:\cygwin64\home\admin\201.sh (steps to be performed like this can be added down)
Pause
###########################
Use batch processing on Windows to copy files from a remote Linux server to a local