ioliver Posted June 24, 2005 Share Posted June 24, 2005 Ok, here's my code... $objComputers = FileOpen("c:\adcomputers.csv", 0); Opens the file c:\adcomputers.csv for Reading ; Read in lines of text until the EOF is reached ;While 1 ;$Computer = FileReadLine($objComputers) $Computer = "br7spare1" ;If @error = -1 Then ExitLoop RunWait(@ComSpec & ' /c ' & 'psinfo -s \\' & $Computer & ' | find "Office" > c:\off_' & $Computer & '.txt') ;Wend You need to have PSInfo.exe on your C: Drive for it to work. When I run the command: psinfo -s \\COMPUTERNAME | find "Office" > c:\off_COMPUTERNAME.txt from a Command Line it works fine. But my above code does not seem to work. Please let me know if you spot the error. Thanks, Ian "Blessed be the name of the Lord" - Job 1:21Check out Search IMF Link to comment Share on other sites More sharing options...
Guest jhtech Posted June 24, 2005 Share Posted June 24, 2005 Ok, here's my code...$objComputers = FileOpen("c:\adcomputers.csv", 0); Opens the file c:\adcomputers.csv for Reading ; Read in lines of text until the EOF is reached ;While 1 ;$Computer = FileReadLine($objComputers) $Computer = "br7spare1" ;If @error = -1 Then ExitLoop RunWait(@ComSpec & ' /c ' & 'psinfo -s \\' & $Computer & ' | find "Office" > c:\off_' & $Computer & '.txt') ;WendYou need to have PSInfo.exe on your C: Drive for it to work.When I run the command:psinfo -s \\COMPUTERNAME | find "Office" > c:\off_COMPUTERNAME.txtfrom a Command Line it works fine. But my above code does not seem to work.Please let me know if you spot the error.Thanks,Ian<{POST_SNAPBACK}>I notice that you have the ; in front of alot of the commands. The ; acts as a comment so anything after it isn't interperted by autoit as anything to execute. Remove the ; and give it a try. Here it is revised.$objComputers = FileOpen("c:\adcomputers.csv", 0); Opens the file c:\adcomputers.csv for Reading ; Read in lines of text until the EOF is reached While 1 $Computer = FileReadLine($objComputers) $Computer = "br7spare1" If @error = -1 Then ExitLoop RunWait(@ComSpec & ' /c ' & 'psinfo -s \\' & $Computer & ' | find "Office" > c:\off_' & $Computer & '.txt') WendJeff Link to comment Share on other sites More sharing options...
ioliver Posted June 24, 2005 Author Share Posted June 24, 2005 Thanks Jeff, I had those lines commented out for testing. Instead of reading from a file I just assigned a value to the variable $Computer, just to eliminate that as a possible problem. Thanks again for your help, Ian "Blessed be the name of the Lord" - Job 1:21Check out Search IMF Link to comment Share on other sites More sharing options...
jason7237 Posted June 25, 2005 Share Posted June 25, 2005 Ian, I have some headaches as well sometimes when trying to run a @Comspec command. I try to spend sometime working it out, but when I get bored with the issue, then I go for the _RunDos() function that someone posted awhile back and is now included as part of the install. I don't know why it works better, but it usually is more successfull. Also, don't forget the #include file. #Include <process.au3> $sCommand = "psinfo -s \\COMPUTERNAME | find "Office" > c:\off_COMPUTERNAME.txt" _RunDOS( $sCommand ) Jason jason7237 Link to comment Share on other sites More sharing options...
jason7237 Posted June 25, 2005 Share Posted June 25, 2005 uh, sorry, watch the " marks that I left in the code above. You might want to adjust that. jason7237 Link to comment Share on other sites More sharing options...
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