0

I would like to execute an application (C# .NET core) by a little PowerShell script. However I would like during the execution of this application to send one parameter present in the PowerShell script.

How can I execute that ?

Thanks you for your help!

Digitag
  • 235
  • 3
  • 5
  • 11

1 Answers1

0

I think you can send the parameter as an argument to the exe directly and you can read that in the main method easily. Some thing like this:

C:\Foo.exe "test"

Gaurav
  • 782
  • 5
  • 12
  • Let me know if you are facing any issues with this approach. – Gaurav Jan 08 '19 at 04:35
  • Hello, I am very sorry for the delay. However I can not get the parameter in C #. You know how can I gete a parameter on C# ? Thanks for your help! – Digitag Jan 16 '19 at 14:43
  • Inside the Main method you need to add arguments property using that you can get the parameters. Take a look here https://stackoverflow.com/questions/5700631/how-do-i-use-command-line-arguments-in-my-c-sharp-console-app – Gaurav Jan 17 '19 at 03:59