if you have the .net framework installed, not only can you use the command line, you can turn your scripts into actual EXEs!
you have to find jsc.exe on your computer, and copy it to a work folder, or add the path of jsc.exe to your path environ variable.
just use the windows search to find it.
then have fun, and try some code:
save this as eval.bat
-
@echo off
-
echo print(%1%2%3%4%5%6%7%8%9) > try.tmp.js
-
jsc /nologo try.tmp.js
-
try.tmp.exe
-
then, you can do stuff like:
C:\Temp\jscript>eval 400 + 20
420
you can pass thing by the command line to your exes as well:
save this text as args.js, and run jsc.exe args.js
-
import System;
-
import System.IO;
-
import System.Net;
-
import System.Text;
-
import System.Windows.Forms;
-
var url="";
-
var addy="";
-
var dump="";
-
var CMDarguments : String = Environment.GetCommandLineArgs() || ",";
-
print (CMDarguments )
-
C:\Temp\jscript\simples>args.exe this seems to work
args.exe,this,seems,to,work
this one will let you "pipe" stdout to your js exe:
in this case, it pastes the text from the command line to the clipboard, another IO point you can use.
-
import System;
-
import System.Windows.Forms;
-
-
var Console = System.Console;
-
var cb= System.Windows.Forms.Clipboard;
-
var scc = String.fromCharCode;
-
-
-
//var chars : String = "";
-
var chars=[];
-
var len : int = 0;
-
var i : int;
-
var c : String;
-
-
-
while (true)
-
{
-
i = Console.Read ();
-
if (i == -1) break;
-
c = scc(i);
-
chars[len++]=c;
-
}
-
-
-
cb.SetDataObject( chars.join("") , true );
-
Console.WriteLine(chars.join(""));
-
if i compile above as paste.exe for example:
will place today's date on the clipboard.
if you are looking for something specific, ask me, but this should get you started.
also, you can find full .NET documentation online.
although it is slightly more complicated than browser javascript, it has much the same syntax and many of my functions have been pasted from browser code without any editing.
good luck!