Search code examples
batch-filepascalwshpascalscript

Replacement for batch files needed that employs pascal as a source language


Having just completed a fairly large batch script, I have reached my limit as far as spending most of my time implementing arcane work-arounds for the inadequacies of the language.

It's time to look for something better. Windows Scripting Host looks OK, and I can live with JScript but Pascal is my preferred lingo.

Is there a free, actively worked on, scripting tool that uses Pascal as a source language? Something that once installed, allows me to type the name of a script file, just like batch files. I don't want to add scripting to an application, just execute scripts from a DOS prompt.

UPDATE

Hmmm. I'm having trouble seeing how the answers so far would satisfy my needs. Maybe I missed a crucial episode. All I want is to be able to create a file say MyFirstScript.<whatever>:

writeln ('Hello world') ;
Exec ('compiler.exe MyProg') ;
if (ErrorLevel <> 0) then
    begin
    writeln ('Oops!') ;
    end 
else
    begin
    CopyFile ('MyProg.exe', 'OutputFolder\') ;
    end ;

and type MyFirstScript at a DOS prompt (or maybe runscript MyFirstScript)


Solution

  • I found this: http://www.be-precision.com/products/pdscript/. Pretty much exactly what I wanted. It's based on RemObjects Pascal Script Engine. There is a command line compile-and-execute tool and an IDE with code completion. After setting up an association in the registry between the CL tool and .dpas files, I was able to create a HelloWorld.dpas file and run it by typing the filename in a DOS prompt.

    Brilliant. And free.