Search code examples
batch-filenetwork-programmingwindows-cenet-use

Net use Command : Windows CE


I'm trying to send network credentials using Net Use command.

This is what I have:

@echo off
net use \\<serverName>\<shareFolder>\ passw0rd /USER:domain.com\UserName
PAUSE

This automatically inserts the username and Domain but for some reason not the password!!

I have tried it like this as well:

@echo off
net use \\<serverName>\<shareFolder>\ /USER:domain.com\UserName passw0rd 
PAUSE

I have checked the paths I'm using and they definitely work. When i copy them out and paste in RUN they work.

Same goes for the username and passwords.

Everything in google search is purple cause I've clicked on all the links :/


Ok, I thought I had it...

I tried it like this:

@echo off
net use \\<serverName>\<shareFolder>\ <mapName> /USER:domain.com\UserName passw0rd 
PAUSE

And it worked, but only because i entered the password before i tried it like this and then it remembered the password.

So I'm still looking for a way.

Please help.


Solution

  • @echo off
    net use <MapDriveName> \\<serverName>\<ShareFolder>\ /PASSWORD:<Passw0rd> /USER:<UserName>
    PAUSE
    

    This one works for me. Finally :) Hope this can help someone else as well.