Packaging a project (Windows) using the Remote Control API

I’m trying to write a subsystem class in C++ with a function called Compile that would mimic the behavior of selecting Platforms > Windows > Package Project, then save the packaged project in whatever default location is offered
That function should be then accessible through the remote control API under “subsystem functions”.
Is anyone familiar with this process and can help out please?