powershell - 带有 powershell 的 Jenkinsfile。需要帮助处理引号、三双引号和转义字符
问题描述
再会,
我一直在努力处理三双引号,三单引号,转义引号......
我需要执行一个带有引号的 Powershell 命令。
我有什么:
testsDll = powershell(returnStdout: true, script: '((Get-ChildItem -Path $env:WORKSPACE\\src\\Web\\*Unit.Tests.dll -Recurse) -join " ")').trim()
TestDllWithParameters = "$testsDll" + " /TestAdapterPath:" + "${env.WORKSPACE}" + "\\src\\Web\\packages\\NUnit3TestAdapter.3.16.1 /Logger:trx;LogFileName=Web123456.trx /TestCaseFilter:TestCategory!=DEADLOCK^&TestCategory!=QUARANTINE^&TestCategory!=Quarantine^&TestCategory!=NotImplemented^&TestCategory!=InProgress^&TestCategory!=INTEGRATION^&TestCategory!=Integration"
VSCodeExeFullPath = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\Extensions\TestPlatform\vstest.console.exe"
env.VSTESTEXITCODE_WEB = powershell(returnStatus: true, script: """
Start-Process "$VSCodeExeFullPath" -ArgumentList "$TestDllWithParameters" -NoNewWindow
""")'
变量插值有效。我遇到的问题是我想保留两个引号$VSCodeExeFullPath
,$TestDllWithParameters
因为两者都包含空格。
谢谢!
解决方案
推荐阅读
- javascript - 使用堆栈实现的洪水填充不起作用并使页面崩溃
- r - 如何在数据库中找到特定年份添加/删除的国家/地区?
- r - 为什么 RGUI 会自动关闭?
- c - 如何将汉明码 (7, 4) 重写为 (63, 57)
- c# - 如何在统一的 RenderTexture 中获得更好的颜色?
- javascript - Farbic SVG路径长度计算
- javascript - 自定义 Tensorflow 模型 - 在网站中使用网络摄像头进行对象检测
- python - 我试图用pyautogui在搜索器中写一些东西,但它没有写任何东西
- python - 测试我的 GCP Cloud 功能出现错误
- performance - 频繁的分段错误:作业似乎已经崩溃