The two are not directly related. The one in the resources folder is a batch file and precedes the .exe version and isa Windows batch file while the other is a binary program file. The batch file gives the user finer grain control than the .exe version. Having said that they are almost certainly using common techniques for controlling the placement of Calibre files.
Have you tried setting up a Calibre development environment as defined in the
documentation. I would expect the source for calibre-portable.exe to be there (although I must admit I have not checked) and it is likely to be Python code like most of the rest of Calibre.