Jump to content

Printing dos text to text file


Diverge
 Share

Recommended Posts

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 by Diverge
Link to comment
Share on other sites

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

  • Moderators

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

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 :lmao:

Edited by Diverge
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...