Last active
October 1, 2015 17:58
-
-
Save daicham/2034347 to your computer and use it in GitHub Desktop.
Generate random strings and copy to clipboard by ruby on batch file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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