Sign in to follow this  
Followers 0
dufran3

Reading Command line output in AutoIT

5 posts in this topic

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?

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

Woo hoo, I'm finally able to help someone instead of others always helping me!! :-)

RunWait(@ComSpec & " /c " & 'net use f: \\path\path /Persistent:YES > C:\Temp.txt', "", @SW_HIDE)
 $file = FileRead("C:\Temp.txt")
 MsgBox(0, "Network Share Results", "" & $file)
FileDelete("C:\Temp.txt")
Edited by saldous

Share this post


Link to post
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...

Share this post


Link to post
Share on other sites

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:

Share this post


Link to post
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
Sign in to follow this  
Followers 0