0

I am trying to create a control-M script that depends from the environment, so i am trying to define a variable called "folder" that gets a value, according to the env (where the job is executed) and that variable "folder" will be used in the rest of the script.

Here is the script, My problem is that control-M is not able to read the folder variable.

Thanks in advance :) !

enter image description here

Olfa2
  • 69
  • 8

2 Answers2

1

I suggest switching it to have it to capture it as an argument rather than parm/variable (i.e. $folder = $args[0] ) for it to work within a Control-M job.

Also note that Control-M has a very specific method for running PowerShell scripts (unless you are using the latest version of Control-M, i.e. 9.0.21$, in which case it supports PowerShell directly as an embedded script).

For older versions of CM (prior to 9.0.21) see this link -

https://community.bmc.com/s/article/How-do-I-run-a-Powershell-script-in-Control-M

Mark
  • 316
  • 1
  • 5
0

This is how i fix it : if ( '"%%ENV_BATCH"' -eq '"PPD"' ) { $f = '"NASBUOPPD"'; } else { $f = '"BUOPRD"'; } . Thanks all :)!

Olfa2
  • 69
  • 8