Okay! So you can take the approach as below using WMI
and WIN32OLE
require 'win32ole'
wmi = WIN32OLE.connect("winmgmts://")
processes = wmi.ExecQuery("select * from win32_process")
ar = processes.each.with_object([]) {|i,a| a << i.name }
# => ["System Idle Process", "System", "smss.exe", "csrss.exe",...]
if ar.include? "rubyw.exe"
#run a C:/test.rb file
else
# do nothing
end