Context

During the execution of a workflow, an execution context is generated, which usually contains information such as built-in variables and built-in functions.

Built-in Variables

In the conditions statement field, you can call built-in variables by their names, for example:

if = 'Arch=="X64"'

In regular string fields (fields outside of conditions statements are usually string fields), you can use ${} statements to call built-in variables. This syntax is similar to template literals in JS. For example, ${ProgramFiles_X64} represents the path of the Program Files directory, so you can write it like this:

[move_shortcut] step = "Move" from = "./lib.dll" to = "${ProgramFiles_X64}/Microsoft/VSCode/"

When executing this step, assuming the system drive letter is C:, lib.dll will be moved to C:/Program Files/Microsoft/VSCode/lib.dll.

WARNING

If you want to use template string syntax in a conditional statement, make sure the expression is within a string (""):

# This syntax is useful when you need to concatenate strings if = '"${SystemDrive}/User${ExitCode}"=="C:/User0"' # This syntax is verbose when you don't need to concatenate strings if = '"${Arch}"=="X64"'

You can find the complete definition of built-in variables in Definitions and APIs.

Built-in Functions

Built-in functions are usually used in conjunction with conditions, for example:

[kill_code] step = "Kill" if = 'IsAlive("code.exe")' target = "code.exe"

This means if the code.exe process is still running, kill that process.

INFO

Note that built-in functions are typically simple functions with a single string input and a boolean output; if you need to use complex functions, consider executing a script with step Execute.

You can find the complete definition of built-in functions in Definitions and APIs.