Start a new topic

Replacing tokens in dynamic folders with Powershell

In Dynamic Folders with Powershell, the script is transformed to replace RoyalTS variables of the type $xxxx$ (example: $EffectiveUsername$).

In my code, if I put one of these lines :

$MyFilePath = Get-Content -Path "${RootPath}\${Environment}_server_list.csv"

$MyFilePath = Get-Content -Path "${RootPath}\$($Item.Environment)_server_list.csv"

I get the warning "At least one token couldn't be resolved" in the RoyalTS logs.

The 2 lines of code are valid and working Powershell code.

I have the impression that you're replacing variables with a regexpr of the form $\w$, i.e. all characters except space character work. In fact, the following line doesn't generate the warning:

$MyFilePath = Get-Content -Path "${RootPath} ${Environment}_server_list.csv"

due to the space.

Among all the variables provided by RoyalTS, only the following characters seem to be used: a-z A-Z 0-9 . - :

Is it possible to update the variable replacement mechanism so that it doesn't try to replace if there is one of these characters: ( ) { } between the 2 $ ? To have the same behavior as if it were a space character?


1 Comment

Hi Damien,

We are aware of some script languages which may interfere with our token resolution logic and we do have plans to address this at some point. In the meantime you can safely ignore these warnings.


Login or Signup to post a comment