Reputation: 717
I am using a filewatcher script to run powershell script when a new file is created.
From the code sample I used as a blueprint, the script was run using invoke-expression, which I now understand is not a reccomended approach.
Could I without any problems just use & "filepath" instead to launch the script? Or could this complicate Global variables, nesting, brackets and quotes?
Upvotes: 0
Views: 1906
Reputation: 354614
No, it doesn't complicate things. It's exactly what you should do. Invoke-Expression is rarely needed outside of golfed code.
Upvotes: 1