Skip to content

Instantly share code, notes, and snippets.

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

Embed
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 => " + Array.new(8){pattern[rand(pattern.size)]}.join
Win32::Clipboard.set_data(value, Win32::Clipboard::UNICODETEXT)
puts "Stored to clipboard"
__END__
:end
pause
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.