faldo Posted June 16, 2009 Posted June 16, 2009 (edited) 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 June 16, 2009 by faldo Check out my other scripts: RDP antihammer/blacklist generator | Phemex cryptocurrency exchange API
LurchMan Posted June 16, 2009 Posted June 16, 2009 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.
Lars Posted June 16, 2009 Posted June 16, 2009 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
faldo Posted June 16, 2009 Author Posted June 16, 2009 (edited) @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 June 16, 2009 by faldo Check out my other scripts: RDP antihammer/blacklist generator | Phemex cryptocurrency exchange API
herewasplato Posted June 16, 2009 Posted June 16, 2009 maybe StdoutRead [size="1"][font="Arial"].[u].[/u][/font][/size]
faldo Posted June 16, 2009 Author Posted June 16, 2009 I've seen those std-functions but never understood how to use them... would you be as kind as to point me in the right direction to use it for this appliance? Check out my other scripts: RDP antihammer/blacklist generator | Phemex cryptocurrency exchange API
herewasplato Posted June 16, 2009 Posted June 16, 2009 You can glance at this:http://www.autoitscript.com/forum/index.ph...st&p=651194But you might want to use this _RunReadStd() UDF:http://www.autoitscript.com/forum/index.php?showtopic=41894 [size="1"][font="Arial"].[u].[/u][/font][/size]
faldo Posted June 16, 2009 Author Posted June 16, 2009 _RunReadStd() was exactly what i was looking for, thanx a lot! Check out my other scripts: RDP antihammer/blacklist generator | Phemex cryptocurrency exchange API
herewasplato Posted June 16, 2009 Posted June 16, 2009 _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]
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now