Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Anchor
_replacement_process_at_run-time
_replacement_process_at_run-time
Replacement process at run-time

RED and RED Windows Scheduler parse the script for script reference tokens and if the script name is found in the metadata then it is written to the work directory and the token is replaced in the script with the full path to the script file before execution.

...

Code Block
languagepowershell
Import-Module -FullyQualifiedName "$WSL_SCRIPT_WslPowerShellCommon_CODE$" -DisableNameChecking

Example Python use case

Code Block
languagepython
# Trigger the RED Script Sourcing feature 
# Note: This line could also be commented out as the
#       presence of the token is all that is required
#       for RED to trigger the script to be written to
#       the work directory.
path_to_WslPythonCommon = r"$WSL_SCRIPT_WslPythonCommon_CODE$"

# Now we can import the module name 
# Note: Python will automatically look for modules in the script run directory.
import WslPythonCommon