Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7599367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:38:37+00:00 2026-05-30T22:38:37+00:00

I know to open a instance of CMD in windows and get the return

  • 0

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 with 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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T22:38:39+00:00Added an answer on May 30, 2026 at 10:38 pm

    thanks you 2

    i resolved this problem trying another more efficient method:

    require 'win32/api'
    include Win32
    
    # Callback example - Enumerate windows
    EnumWindows     = API.new('EnumWindows', 'KP', 'L', 'user32')
    GetWindowText   = API.new('GetWindowText', 'LPI', 'I', 'user32')
    EnumWindowsProc = API::Callback.new('LP', 'I'){ |handle, param|
      buf = "\0" * 200
      GetWindowText.call(handle, buf, 200);
    
      if (!buf.index(param).nil?)
        puts "window was found: handle #{handle}"
        0 # stop looking after we find it
      else
        1
      end
    }
    

    EnumWindows.call(EnumWindowsProc, ‘title here’)

    bye

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know a way to open up an instance of the operating system
Does anyone know of an open source/free tool for converting pl/sql code to a
I am using JNA with Java to find some properties about open windows on
I know that Open Office Database uses a java database backend. Does anyone have
Do you know any open source/free software C++ libraries to manipulate images in these
I know that being open source does not necessarily makes a program more/less secure
Does anyone know of an open source module or a good method for handling
Does anybody know any fine open source cube browser? Ideally, it would be something
does aybody know about an open source sound library in C++ or some other
Do you know about any open source projects written in XQuery? The larger the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.