Throwback Thursday: Making batch files into executables

PrimalScript 2014 can make a variety of script files into executable files. We call that packaging. This feature is mostly used by VBScript and PowerShell administrators to wrap their scripts into an executable file that can be shipped to end users and prevent prying eyes from seeing what makes the magic happen. For the aforementioned VBScript and PowerShell scripts this usually means a package that executes the code in memory, without the use of a temporary file.

We did however receive quite a number of requests lately to also package Batch or CMD files. Here is where the “Throwback Thursday” comes in. We didn’t think too many admins still use batch files. We are however always happy to comply with simple requests and PrimalScript can now package these batch files into executable files.


Select the “CMD x64” or “CMD x86” engine and you are all set. Obviously there is only a command line engine for batch files.

Since there is no actual batch script engine, these file cannot be executed in memory. A temporary file is created and executed. Please note that user may have the ability to peek at the temporary files while your batch job is executing. Because we cannot determine in advance where the temporary folder will be, your current directory is not necessarily where the executable file resides. Please make sure to always set the current directory your process requires.

Also of note is that the cmd scripts are stored as unicode in the package and are converted to ANSI before written to the temporary file. The conversion uses the default codepage on the system executing the package.