Ask a Question
Advertise on boostr.in
execute basic windows commands using -'ruby'
execute basic windows commands ¬†using -'ruby'
I would like to achieve this using win32ole only and not any other way to execute shell commands in ruby.
shell = WIN32OLE.new('Shell.Application')
my_username = shell.ShellExecute('cmd.exe', 'username', '', 'open', 0)
#Current output => nil
Just want to print my username but generally would like to execute any commands and get its output. I know we have ENV['user'] or echo %username% gives me what I want but want this using win32ole only.
Thanks a lot in advance.
Sep 7, 2015
to add a comment.
Your name to display (optional):
Email me at this address if my answer is selected or commented on:
Email me if my answer is selected or commented on
Privacy: Your email address will only be used for sending these notifications.
To avoid this verification in future, please