Powershell Script execution not recieving data from included files

I am trying to use Node red to execute a script with another script included within it. When I put the data into the one script file, it works as intended. When I call the external file with a . .\file.ps1 include it does not appear to load the data from other file. Is this a feature? If so, how do i disable it.

Solved my own problem. When Node-red (and any other command method i assume) executes a powershell script (external to powershell CLI itself) it utilizes the "C:\Windows\System32" folder as the working folder.

The work around is to stipulate the -path you want to work within as an argument within the powershell.exe command call.

so in your script have a param called "$ScriptDIR" or something and then call the script with a -ScriptDIR "c:\diryouwant" and your done.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.