jenkins之SSH Publishers連接windows


SSH服務器為Window10(安裝OpenSSH)

在Publish Over SSH Plugin插件里執行命令時,只能執行第一句

例如:

dir
dir

只有第一句命令會打印出來

正確寫法

cmd /c "dir & dir"

官方網站issues下找到了解決方法

https://issues.jenkins-ci.org/browse/JENKINS-17809

The solution is to add "cmd /c" before of the command.

Por example, you could to write in the section "Exec command" of the Publish Over SSH Plugin:

cmd /c mkdir "D:\MyFolder\"

Also, if you want to run multiples commands, you could write something like the following statement:

cmd /c "echo Hello & echo My Friend"

On the other hand, is better execute a file batch with the lines to execute:

cmd /c "C:\data\scripts\myScript.bat"

 

Window安裝OpenSSH

參考:https://www.cnblogs.com/SmilingEye/p/12100934.html


免責聲明!

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



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