Skip to content

Instantly share code, notes, and snippets.

@daicham daicham/random.bat
Last active Oct 1, 2015

What would you like to do?
Generate random strings and copy to clipboard by ruby on batch file
@echo off
ruby -S -x %0 %*
goto end
#! ruby
require 'win32/clipboard' # before install "win32-clipboard" gem
pattern = ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a
puts "Random String => " +{pattern[rand(pattern.size)]}.join
Win32::Clipboard.set_data(value, Win32::Clipboard::UNICODETEXT)
puts "Stored to clipboard"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.