windows腳本批處理傳輸文件到linux腳本


安裝pscp

https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

cmd腳本

@echo off
rem 拷貝的文件名稱
set name=zhong-auth.jar
rem 拷貝文件的目錄
set folder=E:\git\zhong\zhong-auth\target\
rem 當前目錄
set current=E:\copysh\
if exist %current%%name% del %current%%name%

xcopy %folder%%name% %current%

pscp -pw 123456 %current%%name% root@192.168.1.107:/home/

@cmd.exe
exist

新建一個目錄,放這個腳本

命令是把當前目錄的jar包刪除,然后拷貝最新編譯后的jar包到當前目錄,然后登錄linux傳輸上去

如果要傳輸完成后直接關閉窗口,就把最后兩行刪掉,改為exit


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM