If you need to mount or unmount ('map' or 'disconnect' in Windows lingo) a Windows (Samba) share from Windows command line or batch file, you can do it with 'net use' command.
To map a network drive:
- Click Start, and then click Run (or use Windows+R keyboard shortcut).
- In the Open box, type cmd to open command line window.
- Type the following, replacing X: with drive letter you want to assign to the shared resource:
net use X: \\computer_name\share_name
- Open command line window.
- Type the following, replacing X: with drive letter of the shared resource:
net use X: /delete