The primary tool for mapping network drives in Windows CMD or batch scripts is net use .
To remove all mapped drives:
This command maps the Z: drive to the shared folder on the server. command line map network drive