How To: Set and Retrieve Variables in Scripts
The values for Job Variables can be read or set at job execution time by any script run as part of the job. This provides even more flexibility in customizing your job's behavior at runtime.
Job Variables are available through the JobVariables collection exposed to all scripts.
When you set variables from a script, the values you set only apply within that instance of the job. To make persistent updates to variables you must use the Job Variable Update Task or Job Variable Update Action.