文件名send_file.bat:
@echo off
setlocal:: 提示用户输入远程IP地址
set /p remoteIpAddress=please input IP::: 定义本地文件名
set "localFile1=111"
set "localFile2=222"
set "localFile3=333":: 获取本地文件的完整路径
set "localFilePath1=%cd%\%localFile1%"
set "localFilePath2=%cd%\%localFile2%"
set "localFilePath3=%cd%\%localFile3%":: 检查文件是否存在
if not exist "%localFilePath1%" (echo File "%localFile1%" does not exist in the current directory.pauseexit /b 1
)if not exist "%localFilePath2%" (echo File "%localFile2%" does not exist in the current directory.pauseexit /b 1
)if not exist "%localFilePath3%" (echo File "%localFile3%" does not exist in the current directory.pauseexit /b 1
):: 定义远程用户名和远程文件路径
set "remoteUsername=root"
set "remoteFilePath1=/usr/bin/"
set "remoteFilePath2=/usr/bin/"
set "remoteFilePath3=/usr/lib/":: 使用scp命令传输文件
scp "%localFilePath1%" %remoteUsername%@%remoteIpAddress%:%remoteFilePath1%
scp "%localFilePath2%" %remoteUsername%@%remoteIpAddress%:%remoteFilePath2%
scp "%localFilePath3%" %remoteUsername%@%remoteIpAddress%:%remoteFilePath3%:: 等待5秒
timeout /t 5endlocal
在window双击send_file.bat