nat45928
nat45928

Reputation: 269

net use in batch file - yes to prompt

I am trying to script a net use command:

net user UserName ReallyLongPasswordHere /add

When I execute this I get a prompt:

The password entered is longer than 14 characters.  Computers
with Windows prior to Windows 2000 will not be able to use
this account. Do you want to continue this operation? (Y/N) [Y]:

How can I yes thorugh this? I tried:

echo y| net user UserName ReallyLongPasswordHere /add

But that doesn't work, it says "No valid response was provided". Windows Server 2008R2 is where this is running.

Thanks!

Upvotes: 2

Views: 5238

Answers (1)

HackSlash
HackSlash

Reputation: 5803

You can add /Y or /YES to answer this prompt.

EXAMPLE:

net user MyUser MyPasswordIsReallyLong /ADD /Y

(This is an undocumented feature.)

Upvotes: 4

Related Questions