Delphi and Batch Files
Posted by jpluimers on 2014/11/06
Two interesting links today about Delphi and Batch files.
- Using batch files to streamline your build process.
This is a really long post explaining a system of batch files to facilitate continuous integration using Batch files and the Delphi commandline compiers. - A workaround for calling batch files from within the Delphi IDE.
(the latter was much easier in Delphi 7 and older; the pre/post build commands are not batch files: they are commands stringed together using the ampersaond (&))
–jeroen
PS: If you want to see some serious Batch file and PowerShell related scripts, then read through the Build Automation part of my session materials I posted to ITDevCon and EKON session materials on Delphi Unit Testing + Build Automation and Continuous Integration on-line.
More details are in the batch files here:
and PowerShell scripts here:






David Heffernan said
Batch is pretty much impossible to write and impossible to read as soon as you want to do anything useful. I’d always opt for a real language. My choice is Python but there are many useful possibilities.
Bruce McGee said
I wouldn’t poo-poo on batch files. They have the distinction of being universally shareable without making assumptions about what recipients have installed. Except Delphi, of course.
And since Delphi 2007, MSBuild makes these much more reliable.
In-house, where you can control the environment – that’s another story. What do you use to automate your builds?
KMorwath said
There is a tool to write scripts “universally” shareable and it used to be Make. Being designed exactly to compile files, make scripts are usually more useful and powerful than batch scripts – and being still a command line utilty doesn’t ask to install much. TurboPascal came with a Make utility, it was later removed.
We use Jenkins to automate builds. It is simpler to connect version control access, build tools and test tools together and make them work without tooo much scripting – and keeping account informations reserved enough.
Bruce McGee said
“used to be”
jpluimers said
Make: talking about a distant past (;
Make is indeed much more powerful than batch files though. So is powershell, for which pash is a cross platform alternative gaining ground: https://github.com/Pash-Project/Pash
I’m using various build systems to do automated builds. The session covers Continua CI, but I’m also using TeamCity and CruiseControl.net. In my experience, for all the majority of time is not getting to know the build system, but getting all the tiny details about parameters, scripts, etc right.
Note about make: I’ve used that too. Too many platform dependencies in the various flavours of make (the version shipped Turbo Pascal wasn’t exactly Unix compliant, and even on Unix it is hard to make things clean and platform independent at the same time).
In practice it comes down to finding the right abstraction levels in various tools.
KMorwath said
Guess the article should be updated to use PowerShell scripts… looks like Delphi developers today just love to live in a distant past. Anyway, today there are better tools to build than using a shell script – especially since old “batch” shell scripts in Windows have limited features.
jpluimers said
I’ll post an update in the article shortly.