Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

how to pass a QB variable to a powershell cmd/script? #2619

ppinkerton ·
Objective is to script this somehow in QB/Groovy. I have tried several ways but have no success. left them out as not to confuse the issue.

Requirements
1) need to run PowerShell from QB
2) need to pass variable from QB to PowerShell path
3) need to configure PS variables to pass in QB

Example:
QB Variable selected from component menu = ${vars.getValue("destdir")}
PS variables needed = $source, $destination (perhaps groovy can handle this ? or not )

actual PS command that needs to be executed =
PS > $source = "D:\Build\C\LPlus\Builds\trunk\Continuous\LPlus\scratch\dist\lplus.war";
$destination = "\server1\it_cm\LPlus-Ref\${vars.getValue("destdir")}\scratch\dist\lplus.war"
PS > New-Item -ItemType File -Path $destination -Force
PS > Copy-item $source $destination -Recurse

perhaps the mix of PS variables and QB variable is not possible ? the PS source and destination variables will change but the QB variable will not.
Essentially the above PS commands will be repeated 8 or more times.

Note: destination path does not exist , the PS script will create the path with sub directories and copy the needed file only without populating the sub directories with files contained in the source. the above PS commands work perfectly from the PS command line. The commands my need to be in a PS script.
  • replies 1
  • views 1963
  • stars 0
robinshen ADMIN ·
Groovy knows nothing about powershell specifically. You will need to pass variables to your external powershell command via command line arguments, or environments (groovy is able to accept environment variables when executing external command, refer to groovy guide for details).