Quantcast
Channel: Task Scheduler Managed Wrapper
Viewing all articles
Browse latest Browse all 2206

New Post: Passing arguments to a powershell script

$
0
0
I've used this format in the past with success:
myTask.Actions.Add("powershell.exe", $"-NoLogo -NonInteractive -WindowStyle Hidden -File \"{scriptFilePathWithNoQuotes}\" {MyStringArgs}", myWorkingDirectory);
Note that if MyStringArgs contains paths that need quotes, you should supply them in the MyStringArgs variable.
var MyStringArgs = "arg1 \"arg2 has spaces\"";

Viewing all articles
Browse latest Browse all 2206

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>