Diverge Posted October 12, 2006 Share Posted October 12, 2006 (edited) I'm trying to run a dos command and have the results written to a text file. For example, in dos, i can type: help >c:\test.txt and the results would be stored in a text file named t.txt on the root of the c: drive. In autoit i've been using: RunWait("help > d:\t.txt","", @SW_MAXIMIZE). I've tried everything i can thing of to try to get this to work, the only way i can do it is to make batch files and have my script run them. But i would like to have everything incorporated into my script. Is it possible to use the ">" for autoit run and runwait commands? Or any other ideas or suggestions i could try (besides having the script write the batch file, then excute it and then delete the batch file when done)? Edited October 12, 2006 by Diverge Link to comment Share on other sites More sharing options...
BigDod Posted October 12, 2006 Share Posted October 12, 2006 Lookup _FilePrint in the help file. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
Diverge Posted October 12, 2006 Author Share Posted October 12, 2006 Lookup _FilePrint in the help file.Thanks for the quick reply. I looked in the helpfile for that command, but didn't find it. Is it something added in a newer version of Autoit and SciTe? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 12, 2006 Moderators Share Posted October 12, 2006 Have you tried Run(@Comspec & ' /c ' etc)... with the > file.txt ? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
sulfurious Posted October 12, 2006 Share Posted October 12, 2006 RunWait(@ComSpec & ' /c dir>"c:\output.txt"',"",@SW_HIDE) Link to comment Share on other sites More sharing options...
Diverge Posted October 12, 2006 Author Share Posted October 12, 2006 (edited) RunWait(@ComSpec & ' /c dir>"c:\output.txt"',"",@SW_HIDE) thanks, using the above command worked. I had tried to use this command too, but used it incorrectly i guess. this is the actual file i was trying to capture the results of: RunWait(@ComSpec & ' /c "d:\devcon.exe find *PID_2228> d:\FindDev.txt"',"",@SW_HIDE) it looks for the device ID (actually product ID) of a particular usb device, and i have another portion of my script trigger when it finds the device i am looking for (when it is plugged in). I'm automating my work Edited October 12, 2006 by Diverge Link to comment Share on other sites More sharing options...
sulfurious Posted October 12, 2006 Share Posted October 12, 2006 The 2 things I found with doing this are assuring your working directory is where you expect it to be when calling a dos command, and paying attention to when dos needs "s p a c e s" quoted, so you use ' on the outside, and " on the insides. later, Sul Link to comment Share on other sites More sharing options...
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