Execute Condition using PowerShell

Hi, I want to check for the existence of a folder before running a build step.
I added a simple:
Test-Path ‘C:\some\path’ which of course works as expected in a PowerShell.

However, in FinalBuilder 8, the condition always evaluates to True, regardless of the path provided.

Any Ideas?


Hi Thomas

It’s a bug. I’m not sure when this started happening, but the powershell api was returning a different object to what we were previously expecting. This build has the fix


Note that another option is the If File/Folder Exists action.


Hi, I tried 2791.
It works for hard-coded string paths, like ‘Test-Path C:\Windows’
But if I use a variable, like ‘Test-Path %SOME_VALID_PATH%’ it always fails.

I also tried the File/Folder Exists option, but that one has other problems.
If I want to set a variable with the result of the operation, the dropdown only shows non-macro variables. But that’s pretty useless. I must of course use a macro variable that is recalculated later.

You can’t reference variables using % in scripts. In powershell you would use

Test-Path $FBVariables["SOME_VALID_PATH"]

As for the File/Folder Exists action - you cannot set macro variables anywhere in FinalBuilder by design. Their value is based on their default value expression, which is evaluated every time the variable is accessed.