Ask a Question
Advertise on boostr.in
Organizational Research By
Surprising Reserch Topic
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.
Related Hot Questions
Government Jobs Opening