Jump to content

Reading Command line output in AutoIT


dufran3
 Share

Recommended Posts

I am running this command via AutoIT

_RunDOS(net use f: \\path\path /Persistent:YES)

I would like to check to see if it is successful, When running directly from command prompt, it returns this.

C:\Program Files\Windows Resource Kits\Tools>net use \\path\path /persi
stent:yes
Local name
Remote name    \\path\path
Resource type    Disk
Status          OK
# Opens        0
# Connections    1
The command completed successfully.

I would just like to be able to check to ensure the drive mapped, is there a good way to do this?

Link to comment
Share on other sites

Read the stdoutread example.

use a second $var that glues all lines together like $var=$var&$line

Replace dir foo.bar with net use f: \\path\path /Persistent:YES

Add a If StringInStr($var, successfully') Then MsgBox(0,'', 'Yeah') and you're done...

Link to comment
Share on other sites

  • 3 weeks later...

RunWait(@ComSpec & " /c " & 'wmic qfe > C:\Temp.txt', "", @SW_HIDE)

$file = FileRead("C:\Temp.txt")

MsgBox(0, "Network Share Results", "" & $file) <<--- OUTPUT LINE.

FileDelete("C:\Temp.txt")

For the above script code, I would like to have the output of the DOS command

"wmic qfe" displayed in a scrollable GUI window. Currently, the DOS command

output is read into the file "C:\Temp.txt" but I want the output to go into

scrollable GUI window. Please let me know how this can be accomplished. :whistle:

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...