28

I'm issuing some "net user" commands to setup a local user on my desktop for some testing purposes and require setting a password longer than 14 characters. In doing so Windows barks back a propmt to confirm the long password, and I'm wondering if anyone knows how to suppress that prompt and force the long password to be set. You can see the prompt I'm speaking of by issuing the following command...

net user MyUser MyPasswordIsReallyLong /ADD

It triggers the following 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]:

Also, could one of the more senior members help create the following tag: net-user

jxramos
  • 789
  • 1
  • 8
  • 11

1 Answers1

38

Apparently you can add

/Y

and the shell knows to interpret that as supplying a default answer of "yes" to the prompt.

net user MyUser MyPasswordIsReallyLong /ADD /Y
jxramos
  • 789
  • 1
  • 8
  • 11
  • 2
    Thanks, is this an obscure shell feature... or part of `net` because it's not documented clearly... At least not to me. – jonasfj Jun 09 '15 at 17:17
  • 3
    /Y is totally not documented in the net.exe help system – shufler Feb 16 '16 at 23:36
  • @shufler, I know it's maddening, I wound up taking inspiration from the copy/xcopy examples: `/Y Suppresses prompting to confirm you want to overwrite an existing destination file.` – jxramos Feb 17 '16 at 01:49
  • 1
    The good news is /Y is a common convention and that it works suggests the developer/designer of NET.EXE was smart. :) This wouldn't be the first discrepancy with the documentation though. – shufler Feb 17 '16 at 18:17
  • FYI, "/Y" does not work on Windows 2016 server – Aleks G Sep 27 '20 at 12:33
  • It does work on Windows 2019 Server – xorinzor Feb 25 '21 at 13:36