0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

32桁の乱数を作成したい時

Posted at

APIKEYを作成したい時など、乱数が欲しいときなど
バッチで手軽に使用できるコマンドです。


32桁の英数字+記号の乱数を作成します。
以下のファイルを作成してください。

ransu.bat
@echo off
powershell -NoProfile -ExecutionPolicy Unrestricted -Command "& { $char='abcdefghkmnprstuvwxyzABCDEFGHKLMNPRSTUVWXYZ123456789!$^&/()=?*+#_'; -join ${char}[(1..32 | ForEach-Object { Get-Random -Maximum ${char}.length })] }"
pause

あとは作られたransu.batをダブルクリックしてください。
以下のように出ればOK
image.png

英数字のみの場合

ransu_eisu.bat
@echo off
powershell -NoProfile -ExecutionPolicy Unrestricted -Command "& { $char='abcdefghkmnprstuvwxyzABCDEFGHKLMNPRSTUVWXYZ123456789'; -join ${char}[(1..32 | ForEach-Object { Get-Random -Maximum ${char}.length })] }"
pause
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?