These are my virtual machine settings:
As you can see, VMWare Workstation Player 16 allows me to enable some shared folders I set using the GUI.
Is there any way to do this programmatically while logging into the virtual machine (i.e., the guest OS)?
It's not possible.
Read the warning above the disable/enable option to understand why it's not a good idea. Imagine running a VM one downloads from the internet and without user interaction, it having access to the whole host OS.
As an alternative, you could provide a script that runs vmrun
and that sets up the VM and the shared folders.