Jump to content

Retur from commandprompt?


Recommended Posts

Is there a way to capture the return from a _RunDOS command?

As an example, lets say i need to gather DHCP-information from a computer by useing the "ipconfig"-command.

This won't work.

#include <Process.au3>
$rc = _RunDos("ipconfig")
MsgBox(0, "", $rc)
Edited by faldo
Link to comment
Share on other sites

a quick and dirty way of doing it (and i know theres a much better way, but this works) is to just write the command to a txt file, then have auto it read the text file.

_RunDos("ipconfig >> c:\test.txt")

Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end.

Link to comment
Share on other sites

Hi Faldo,

Is there an other way to reach your goal,

For example if you want to use ipconfig, you can also use function provided by autoit to retreive an ip.

Using commandline stuff is most of the times bad practise and can also be done by using windows dll functions

and 15min of scripting.

So if you don't give us the example but the real case, there could be a better solution.

Lars

Link to comment
Share on other sites

@Lars: Erm... i did give an example, but if you don't understand what i'm looking for here are two examples:

ie1: If you type "ipconfig /all" in a cmd-prompt, you get a whole lot of info, info that autoit won't provide with native functions... i need to gather that info.

ie2: If you type "systeminfo" in a cmd-prompt, you get a whole lot of info, info that autoit won't provide with native functions... i need to gather that info.

Sure autoit has some functions that returns portions of what i mention above but i need all of it.

I'm not sure how i can be any more clear on what i'm looking for Lars, sorry.

@LurchMan: Thanx for the quickfix, creating a file might not be optimal but does the job. Know if that ">>" syntax can push data in to an array somehow?

Edited by faldo
Link to comment
Share on other sites

_RunReadStd() was exactly what i was looking for, thanx a lot!

You are welcome - and you helped me too.

Every time that I go searching the forum for that UDF, I am reminded that it cannot be found using a "Search title only" for RunReadStd or _RunReadStd.

Searching for UDF _RunReadStd() works if you can remeber it.

This time, I bookmarked it in my profile :-)

Hmmm... maybe I can get lod3n to change the topic title.

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...