dufran3 Posted February 26, 2007 Posted February 26, 2007 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?
BugFix Posted February 26, 2007 Posted February 26, 2007 One way: $foo = Run(@ComSpec & " /c " & 'net use f: \\path\path /Persistent:YES', "", @SW_HIDE, $STDOUT_CHILD) While 1 $line = StdoutRead($foo) If @error Then ExitLoop $str &= $line Wend Now the DOS-output includes in $str Best Regards BugFix
saldous Posted February 26, 2007 Posted February 26, 2007 (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 February 26, 2007 by saldous
dabus Posted February 26, 2007 Posted February 26, 2007 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...
AKYJedi Posted March 13, 2007 Posted March 13, 2007 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.
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