我想通过在环境变量中定义它们来参数化测试数据路径、结果路径、服务器和端口。
System.getenv("Jmeter_Result")
通过在BeanShell 处理器中使用它,我能够在一定程度上实现这一点。但我需要使用配置元素来获取值。
你能提出建议吗?我正在使用 Jmeter 3.1。
问题: Robocopy 无法以其他用户身份启动Start-Process
该脚本在具有两个文件位置权限的帐户上运行时运行良好,但它似乎不接受-credential
参数。
不确定我的格式是否不正确,或者我做错了什么。
# Create Password for credential
$passw = convertto-securestring "Password" -asplaintext –force
# Assembles password into a credential
$creds = new-object -typename System.Management.Automation.PSCredential -argumentlist "DOMAIN\Username", $passw
# Select a source / destination path, can contain spaces
$Source = '\\Source\E$\Location'
$Destination = '\\Destination\Location Here'
# formats the arguments to allow the credentials to be wrapped into the command
$RoboArgs = "`"$($Source)`" `"$($Destination)`"" + " /e /Copy:DAT"
# Started Robocopy with arguments and credentials
Start-Process …
Run Code Online (Sandbox Code Playgroud) 我有这个在 powershell 上运行正常的命令
Compare-Object (Get-Content "tex1.txt") (Get-Content "tex2.txt") | Where-Object{$_.SideIndicator -eq "<="} | select inputobject | ft -hidetableheaders
Run Code Online (Sandbox Code Playgroud)
我正在尝试通过执行以下操作在 cmd 中运行:
powershell -Command " & {Compare-Object (Get-Content "tex1.txt") (Get-Content "tex2.txt") | Where-Object{$_.SideIndicator -eq "<="} | select inputobject | ft -hidetableheaders}"
Run Code Online (Sandbox Code Playgroud)
但它说的是:名称、目录或卷语法不正确(是西班牙语,所以我不知道确切的翻译)
我认为问题在于管道,因为在管道之前运行所有内容:Compare-Object (Get-Content "tex1.txt") (Get-Content "tex2.txt")
有效
PD:我也尝试^
在管道之前写,但我没有成功。