How to run a Powershell script from C# that references another script -


i'm trying run powershell script c# program so:

var ps = powershell.create(); ps.addscript(@"<full-path-to-script>.ps1").invoke() 

but fails because within script references script gives me error saying it's not found. however, running script commandline works fine. i'm not sure understand why not working within c# works in commandline. ideas?

probably have different working directories. how line inside <full-path-to-script>.ps1 includes second script? should use $psscriptroot.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -