What command line tool can generate passwords on Windows?

Depends on how strong you want your password to be. Of course if security is not a concern then echo %random%%random% in cmd or Get-Random -Minimum 100000000 in PowerShell will just work

With PowerShell you have another better option: call GeneratePassword(int length, int numberOfNonAlphanumericCharacters). For example to generated a 12-character long password with at least 3 special symbols you can call it like this

# Just need to call once at the start of the script
[Reflection.Assembly]::LoadWithPartialName("System.Web")

[System.Web.Security.Membership]::GeneratePassword(12, 3)

There are several MS TechNet blog posts on this:

  • Generating a New Password with Windows PowerShell
  • How to Generate a Secure Random Password using PowerShell
  • PowerShell Random Password Generator

In case you don't want to work with PowerShell then here's a pure batch solution


Cross-Platform: Using PERL

There's a PERL password generator that works for Windows, *nix, OS X, etc.

Usage: genpass [-OPTIONS] LENGTH
-s, --symbols       Exclude symbol characters.
-n, --numbers       Exclude number characters.
-u, --uppercase     Exclude uppercase characters.
-l, --lowercase     Exclude lowercase characters.

On Windows, it can be converted into an executable.

Windows-only

Warning: This will change the password for the administrator account.

Not specifically what you want, but could also come in useful. In the command line, type:

net user administrator /random    

enter image description here

Unix/Linux

See answers of this question: Random password generator: many, in columns, on command line, in Linux