in reply to Re: Execute wmic command in cmd
in thread Execute wmic command in cmd

Tnx for the reply. I dont think we understand....maybe i confuse u with that telling you "is like telent". So i will try explain again. The first command when i execute is like this:

C:\Users\mypc\Desktop\Perl>wmic wmic:root\cli>

so as you can see wmic command is execute and i got the "wmic:root\cli>" prompt and here i have to execute the "diskdrive get status" command that will show me if the disk is ok or not. Here is how it looks like all the procedure ....

C:\Users\mypc\Desktop\Perl>wmic wmic:root\cli>diskdrive get status Status OK wmic:root\cli>

Replies are listed 'Best First'.
Re^3: Execute wmic command in cmd
by BrowserUk (Patriarch) on May 15, 2013 at 17:44 UTC
    as you can see wmic command is execute and i got the "wmic:root\cli>" prompt and here i have to execute the "diskdrive get status" command that will show me if the disk is ok or not.

    You can do it that way. (Ie. interactive mode.)

    But, you can also do it all in one go: wmic diskdrive get status as I showed above. (Try it it on your command line. )

    And the second way is the easiest way to do it from a program. (Again; try the code I posted for yourself.)

    It is not just the easiest way. Trying to use the interactive mode from within a Perl program is (almost) impossible.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
Re^3: Execute wmic command in cmd
by roboticus (Chancellor) on May 15, 2013 at 17:45 UTC

    mvib:

    As you can see below, you can either use wmic interactively ("like telnet") or as a simple command-line driven program.

    H:\>wmic wmic:root\cli>diskdrive get status Status OK wmic:root\cli>quit H:\>wmic diskdrive get status Status OK H:\>

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

      Well tnx guys i just dont see the other comma `` i was using the others '' i forgot about writhing in Perl :S sorry any way tnx and it works

      now im trying to put the results in a variable ...

        "now im trying to put the results in a variable ..."

        BrowserUK gave you that here.