spiderkayak Posted March 14, 2005 Posted March 14, 2005 it does not execute the line: RunWait("psexec \\$line -c ops.exe","",@SW_HIDE) the problem I believe that it is in the variable $line (wich saves a server name), because if I enter the the server name, replacing the $line variable, the command run ok Here I've leaved my script, please check it!! ************************************************************* $file = FileOpen("servers.txt", 0) If $file = -1 Then Exit EndIf ; Read in lines of text until the EOF is reached While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop RunWait("psexec \\$line -c ops.exe","",@SW_HIDE) Wend FileClose($file) ************************************************************* Thank a lot
spiderkayak Posted March 14, 2005 Author Posted March 14, 2005 RunWait("psexec \\" & $line & " -c ops.exe","",@SW_HIDE)<{POST_SNAPBACK}> Hello Larry thank you for your help I did with <RunWait("psexec \\" & $line & " -c ops.exe","",@SW_HIDE)> and I could run it with the variable. I'm getting the server names from a file text, I could to get the first value (server name), but the 2nd or 3th I can't get it.
spiderkayak Posted March 14, 2005 Author Posted March 14, 2005 $files = FileRead("servers.txt",FileGetSize("servers.txt")) $files = StringSplit(StringStripCR($files),@LF) For $i = 1 to $files[0] If StringStripWS($files[$i],8) <> "" Then _ RunWait("psexec \\" & $files[$i] & " -c ops.exe","",@SW_HIDE) Next<{POST_SNAPBACK}> Larry, it funtions I mean run remotely, but without the server name. I get a blank variable, I mean the variable can't get the server name from the file text.I'd like to know how do you think the code could be? is it neccesary put the code I made before.$file = FileOpen("servers.txt", 0)If $file = -1 ThenExitEndIf; Read in lines of text until the EOF is reachedWhile 1$line = FileReadLine($file)If @error = -1 Then ExitLoopRunWait("psexec \\$line -c ops.exe","",@SW_HIDE)WendFileClose($file)Thank a lot
spiderkayak Posted March 14, 2005 Author Posted March 14, 2005 start here...$files = FileRead("servers.txt",FileGetSize("servers.txt")) MsgBox(4096,"",$files)does that show the contents of the file? Each line a new server name?Lar.<{POST_SNAPBACK}>Yes, each line is a new server name:server1server2server3everything appear in just one windows
spiderkayak Posted March 15, 2005 Author Posted March 15, 2005 ok, next this line splits all the servers into an array...$svrs = StringSplit(StringStripCR($svrs),@LF)then a for loop using element[0] and adding an if statement for any anomoles.. but here is a msgbox test...$svrs = FileRead("servers.txt",FileGetSize("servers.txt")) $svrs = StringSplit(StringStripCR($svrs),@LF) For $i = 1 to $svrs[0] If StringStripWS($svrs[$i],8) <> "" Then _ MsgBox(4096,"","psexec \\" & $svrs[$i] & " -c ops.exe") ; RunWait("psexec \\" & $svrs[$i] & " -c ops.exe","",@SW_HIDE) Nextdoes that show you the Run String for each server?Lar.<{POST_SNAPBACK}>thank you very much larry, script already works
WhiteCrow Posted May 17, 2005 Posted May 17, 2005 (edited) Thanks guys, i had much help from this, i created a random word generator with your code. ;373709 words in my dictionary #include <file.au3> Dim $word If Not _FileReadToArray("dictionary.txt",$word) Then MsgBox(4096,"Error", " Dictionary.txt is missing error:" & @error) Exit EndIf $x = Random (1, 373709, 1) Msgbox(0,'Word: ' & $x, $word[$x]) Its of no use, but i wanted to tell you guys anyway Edited May 17, 2005 by WhiteCrow
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