[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[转载代码] [PowerShell每日技巧]创建随机密码(20131211)

Here's a chunk of code that creates random passwords of different lengths for you:
  1. $length = 8
  2. $characters = [Char[]]((31..50) + (65..90) + (97..122))
  3. $characters = $characters -ne 'O' -ne 'o' -ne 'l' -ne '1' -ne '-'
  4. $password = -join ($characters | Get-Random -Count $length)
  5. "Your temporary $length-character-password is $password"
复制代码
The password length is set by $length. The characters used to compose the passwords are defined in $characters. By default, all ASCII codes from 31-50, 65-90, and 97-122 are used. As you can see, with the -ne operator, you can fine-tune the list and exclude characters. In our example, we exclude characters that can easily be misinterpreted.

http://powershell.com/cs/blogs/tips/archive/2013/12/11/creating-temporary-password.aspx
1

评分人数

    • CrLf: [Char[]]技术 + 1

返回列表