Pass a JSON string as a command line argument

后端 未结 6 1742
一个人的身影
一个人的身影 2021-01-04 18:19

I am trying to pass a json string to a C#-Program using Commandline.

The JSON-String looks like this:

{
    \"config\": {
        \"script\": {
             


        
6条回答
  •  既然无缘
    2021-01-04 19:05

    Instead of looking at the "string[] args" you could use Environment.CommandLine.

    From MSDN https://msdn.microsoft.com/en-us/library/system.environment.commandline.aspx

    public static void Main() 
    {
       Console.WriteLine();
       //  Invoke this sample with an arbitrary set of command line arguments.
       Console.WriteLine("CommandLine: {0}", Environment.CommandLine);
    }
    

    // The example displays output like the following: // C:>env0 ARBITRARY TEXT //
    // CommandLine: env0 ARBITRARY TEXT

提交回复
热议问题