I just want to know how to pass arguments to windows services . The problem is , i am developed a windows application and then called it from Onstart() method . Now , i want to call the particular function from another project .
protected override void OnStart(string[] args)
{
Process.Start("C:\\Program Files\\macro.exe");
}
I want to call a function inside the macro.exe project with arguments . Any suggestions
If you want to use arguments passed to service, you can try:
Process.Start(@"C:\Program Files\macro.exe", String.Join(" ", args))
Note that using @Tudor answer you can have better control on started process, redirect input/output/error, show/hide window and many other nice things.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With