Script 2 Batch Compiler

This web page is temporary.


Script 2 Batch Compiler is a project aimed at making windows scripting easy and user friendly. It was originally thought of in late November 2010.

Latest svn version
Script 2 Batch Compiler features:
*compensates and walks around glitches and problems batch code has.
*Makes it easier to write and read batch code.
*Adds new functions to the batch language. Such as Arrays and more proper if statements.

How to use

Script 2 Batch Compiler uses a script that resembels PHP script.
Curently the project is webb only but the plan is to move to XLS when the project has come a bit further.
Paste or write a script in the text box and press convert you may need to toogle edit before doing that. Then copy the output to your .bat file and your done.
Since the project currently is in pre alpha state it only runs in FireFox and you will need the firebug add-on for FireFox. Cause of memmory leaks caused by poor memmory manegment from firefox. It is recomended to refresh the page after a couple of convertions.

Variables are identified by the $ sign
$num1r = 34;
$num_var = $num1r * 23 +4;

code lines are ended with ;

Strings are defined with " NOT '
Escaping " in strings is done with ^"

if and else statements
if(1==2 || "gh" != "qw" && 1>0){
    echo("if was true");
}else if($num1r >= 34)
    echo("else if was true");
    echo("else was true");

while statements
$i = 0; while(10>$i){
    echo("if was true");
    if($i == 5)
$i = 0; while(10>$i)

for statements
    echo("if was true");
    if($i == 5)

function defines
function my_function($a_variable,$one_more)
    echo( str_concat("it is a function $_variable has the value of: ",$a_variable) );
    return ($one_more+2,$one_more-3);

echo(my_function("awesome",34)[1]); //all user defined functions returns arrays where [0] is the length of the array and [1] is the first output.


// Prints $str to console. Returns nothing.

// Returns $str0 and $str1 concated.

// Returns sub string of $str, starting att $start ending at $length, $length may be omitted.

// Returns the environment variable named $str.

// Returns user input $str is a optional question.

// Not DONE.... adds reg key at $str1, options is $str2(open cmd and write reg add /? for more info about options).

// Not DONE.... removes reg key at $str1, options is $str2(open cmd and write reg delete /? for more info about options).

// Not DONE.... get reg key at $str1, options is $str2(open cmd and write reg query /? for more info about options "/v "+"$value_name" is most likely the wanted option).

// returns nothing writes $str2 to file $str1.

//returns an array with file $str1.

// returns nothing appends new line with data $str2 to file $str1.

// waits fore user to continue.

//Returns nothing, sets current working disk to $str example: set_volume("c");

// includes library: current librarys is LTA and LTSA both witch are used to read command output and file contents.

//Returns files or/and directory's in current working directory. Output is in a form of an array. Filter -D only directory's D only files sort after D or N or other sorting type. Timetype defines with time to sort files after(if files are sorted by time):creation = C, last written = W or last access = A

cd($str) //sets or gets the current working directory.

str_pos($hay_stack,$needle,$from) //finds a substring in a string. Starts search at $from witch has the defult value 0. Returns -1 if string was not found

str_pos_last($hay_stack,$needle,$from) //finds a substring in a string like str_pos it but searches backwards. Starts search at $from witch has the defult value 0. Returns -1 if string was not found

pure_line($str) //prints a batch line without processing it.

start($str) //Starts a program or batch file.

file_del($str) //Deletes a file.

dir_del($str) //Deletes a directory.

str_len($str) //Returns the length of the string.

str_replace($str,$replace,$with) //Replaces a sub string in a big string with a substring.

file_copy($from,$fileto) //Copys a file.

file_move($filename,$fileto_filder) //Moves a file.

file_exists($file) //Returns 1 if file exists return 0 if i doesent.

call($file) //calls a executeblefile lite a function.