CS-Script 3.20.0

Embedded Script Arguments

Some times it is convenient to execute script every time with the same command-line arguments. In such case you can specify command-line arguments directly from code. Note that both script and script engine arguments are allowed except /noconfig engine command-line switch. 

This is the directive to use embedded parameters:
 //css_args arg0[,arg1]..[,argN];

arg0..N - script or script engine argument

Remember that you may need to escape some path characters that conflict with the //css_ delimiters. See Delimiters Escaping section.


The file test.cs contains the following code:

//css_args /dbg, "Arg0, ", Arg1;
using System;

class Script
    static public void Main(string[] args)
        System.Diagnostics.Debug.Assert(args.Length > 1);

The script will always print in console window "Arg0, Arg1". Also note that it will be executed in debug mode.  

The directive //css_args /dbg, "Arg0, ", Arg1; is an equivalent of the following command prompt command:

 cscs /dbg test.cs "Arg0, " Arg1