I commonly use batch and script files in Windows and Linux respectively – they’re easy to code, save time for the end user and work instantly on a single double-click (well, most of the time). Sometimes however, it’s useful to convert them to an executable format to stop well-meaning users unintentionally fiddling with them.
Over on Daily Cup of Tech, Tim Fehlman writes about how to turn a Windows batch file into an executable.
That’s all well and good, but I can see at least two problems with this:
- What if the batch file needs to be modified? It can’t be edited by the end user unless they edit the source .bat file and then recompile it.
- There’s no way I know of to do this for Linux. Any ideas?
- It’s not technically been compiled, it’s just a wrapper around the batch file.
- What if the file in particular being called by the batch file doesn’t exist? There is no way I can see to handle exceptions in batch files.