How to force Windows to prompt for credentials while accessing share

if you type the command

net use \\SERVERNAME /u:DOMAIN\USER 

you will be prompted for the password of that user to be used when accessing that server


If the accepted answer gives you this error;

System error 1219 has occurred.

Multiple connections to a server or shared resource by the same user, using 
more than one user name, are not allowed. Disconnect all previous connections 
to the server or shared resource and try again.

You'll need to first remove the existing shares. If you're in a hurry, this will nuke all of them, regardless of server;

NET USE * /DELETE

If, you want to be a bit more precise and preserve your other shares, use the following command to list the existing shares on the server;

NET VIEW \\SERVERNAME

Then delete the conflicting share with;

NET USE \\SERVERNAME\SHARENAME /DELETE

Finally, using the accepted answer will succeed;

NET USE \\SERVERNAME\SHARENAME /u:USERNAME
Enter the password for 'USERNAME' to connect to 'SERVERNAME':
The command completed successfully.