Hi!
I know to open a instance of CMD in windows and get the return code
puts %x[Tasklist /v | Find “%tmp:~0,30%” >NUL]
response = $?.exitstatus
that works.
But now i need to open a hide instance of the CMD, i only know to do it
eith Win32ole module, and the funcion “exitstatus” sends me an error…
i don’t know why…
Please help to get the exit code of that instance, or another way to
open (and get exitcode) of a hide instance.
require 'win32ole'
shell = WIN32OLE.new('Shell.Application')
shell.ShellExecute('CMD', '/K Tasklist /v | Find "%tmp:~0,30%" >NUL',
'', '', 0)
response = $?.exitstatus
if response == 0
puts "hola"
end
undefined method `exitstatus’ for nil:NilClass
(NoMethodError