Command Line Args from Compiled Javascript

  • Thread starter Thread starter Norman
  • Start date Start date
N

Norman

Hello All,

I have a large WSH Javascript script that I want to convert to .Net
Javascript.

How do I accomplish the same functionality as - var args =
WScript.Arguments; within the .Net Framework.

One would think that the System.Console class would handle this, but
it doesn't.

Is there something like C#'s public static void Main( string[] args )
{ } available.

Does Javascript even have a "main"?

Thanks,
Norman
 
Not sure how JScript.NET implements it's entrypoint function. However, you
can use System.Environment.GetCommandLineArgs().

-mike
MVP
 
(e-mail address removed) (Norman) wrote in
Hello All,

I have a large WSH Javascript script that I want to convert to
.Net Javascript.

How do I accomplish the same functionality as - var args =
WScript.Arguments; within the .Net Framework.

One would think that the System.Console class would handle this,
but it doesn't.

Norman,

Here's a silly program I wrote in JScript.Net that shows one way to
get the command line arguments:

http://99-bottles-of-beer.ls-la.net/j.html#JScript/NET
Is there something like C#'s public static void Main( string[]
args ) { } available.

Does Javascript even have a "main"?

Not that I know of. Execution begins with the first line of code in
the first .js file specified on the compiler's command line.

Hope this helps.

Chris.
 
Back
Top