Python
or using CDATA:
or using an external script:
You might use this keyword to run include some python code to be run during the Batch. The code must be indented correctly as required by Python. If the code is written in the batch file itself (i.e., it is not in an external script) and it contains some XML characters like ‘<’, these characters must be escaped. In most cases, it is simpler to simply enclose the whole Python code in XML CDATA sections in which XML characters do not have to be treated differently.
For example, you might use some Python script to compute a value from another:
Any new python variable declared in the python script will be available during the continuation of the script. So you might even use this capability to define some variables or arrays.
There is an important distinction between Python code inside a <python> element as just described, and Python code used in a Calculator task to transform variables within the project. In the latter case, you may wish to refer to variables defined in the batch file, but these variables are not in the scope of the Python code in the Calculator task. In such a case, you can refer to values of the batch-file variables by using $(expr) syntax, so that the Python expression expr is evaluated prior to the code being loaded into the Calculator. (Note that when Python code is in a CDATA section, any <eval> tags in it will not be evaluated, so the $() form must be used instead.)
