X
x1
objWMIService.Create takes a parameter which is set to the pid of a
given process..
IE:
------start_process.vbs-----
strComputer =3D "."
Set objWMIService =3D GetObject("winmgmts:\\.\root\cimv2:Win32_Process")
Error =3D objWMIService.Create("cmd /c exit 10", null, null, pid)
Wscript.Echo pid
------/start_process.vbs-----
While trying to incorporate this within ruby, I ended up with
something of the like:
------start_process.rb---------
require 'win32ole'
pid =3D nil
objWMIService =3D WIN32OLE.connect("winmgmts:\\\\.\\root\\cimv2:Win32_Proce=
ss")
error =3D objWMIService.Create("notepad", nil, nil, pid)
puts pid # nil
------/start_process.rb---------
How can I set a variable equal to the pid value just as the vb script does?
I did find an object in ObjectSpace that has the "notepad" command and
displays the PID:
ObjectSpace.each_object(Array) { |x|
p x if x[0] =3D=3D "notepad"
}
["notepad", nil, nil, nil]
["notepad", -2147352572, -2147352572, 268]
=3D> 1363
irb(main):008:0>
Any ideas?
given process..
IE:
------start_process.vbs-----
strComputer =3D "."
Set objWMIService =3D GetObject("winmgmts:\\.\root\cimv2:Win32_Process")
Error =3D objWMIService.Create("cmd /c exit 10", null, null, pid)
Wscript.Echo pid
------/start_process.vbs-----
While trying to incorporate this within ruby, I ended up with
something of the like:
------start_process.rb---------
require 'win32ole'
pid =3D nil
objWMIService =3D WIN32OLE.connect("winmgmts:\\\\.\\root\\cimv2:Win32_Proce=
ss")
error =3D objWMIService.Create("notepad", nil, nil, pid)
puts pid # nil
------/start_process.rb---------
How can I set a variable equal to the pid value just as the vb script does?
I did find an object in ObjectSpace that has the "notepad" command and
displays the PID:
ObjectSpace.each_object(Array) { |x|
p x if x[0] =3D=3D "notepad"
}
["notepad", nil, nil, nil]
["notepad", -2147352572, -2147352572, 268]
=3D> 1363
irb(main):008:0>
Any ideas?