簡體   English   中英

如何使用 powereshell 在 Jenkinsfile 中打印當前工作目錄

[英]How can I print the current working directory in a Jenkinsfile using powereshell

我試過這個

powershell( returnStdout: true, script: 'Get-Location' )

但我在日志中得到的只是一個空白行,值得說明諸如Write-Output類的命令工作。

Since this syntax returns the output stream, ie stream 1 of Powershell output without printing it to the console, you need to store the stdout in a variable and print it explicitly in the Jenkinsfile.

currentDir = powershell(returnStdout: true, script: 'Get-Location')
println(currentDir)

請參閱Microsoft PowerShell 對 Pipeline 的支持

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM