antmar904 Posted April 5, 2018 Share Posted April 5, 2018 For $i = 0 To UBound($ComputerName) - 1 $iFileExists = FileExists("\\" & $ComputerName[$i] & "\C$\Temp\Agent15\install_agent.bat") If Not $iFileExists Then Next FileWriteLine($LogFile, @MON & "/" & @MDAY & "/" & @YEAR & " - " & @HOUR & ":" & @MIN & ":" & @SEC & " Running installer") ;I'm doing more stuff if the bat file exist. Next Hi I am looping through a txt file with computer names and checking if the bat file exists on the remote computer if it does not how do I skip this computer "$ComputerName[$i]" and move on to the next and start from the beginning from "For"? Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted April 5, 2018 Moderators Share Posted April 5, 2018 Why not just: If FileExists("\\" & $ComputerName[$i] & "\C$\Temp\Agent15\install_agent.bat") Then ;Do something EndIf Then if the file doesn't exist, the PC is skipped. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
JohnOne Posted April 5, 2018 Share Posted April 5, 2018 ExitLoop AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
antmar904 Posted April 5, 2018 Author Share Posted April 5, 2018 I guess I'm ultimately trying to see if the pc is on before moving forward, I just thought of the ping. Ping($ComputerName[$i]) If @error Then ExitLoop EndIf Will ExitLoop go back to the top of the loop and go through the rest of the computer names? Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted April 5, 2018 Moderators Share Posted April 5, 2018 (edited) I guess I am confused as to what you're after. If you ExitLoop, however many machines remain in the array will not be checked. If you then start the For Loop again from the beginning, unless you're doing something else to remove that computer from the array, you're going to exit again as soon as the array comes to this same PC. Edited April 5, 2018 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
JohnOne Posted April 5, 2018 Share Posted April 5, 2018 2 minutes ago, antmar904 said: I guess I'm ultimately trying to see if the pc is on before moving forward, I just thought of the ping. Ping($ComputerName[$i]) If @error Then ExitLoop EndIf Will ExitLoop go back to the top of the loop and go through the rest of the computer names? No. Try ContinueLoop. Danp2 1 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
antmar904 Posted April 5, 2018 Author Share Posted April 5, 2018 Thank you all again, It was ContinuLoop I was looking for! Link to comment Share on other sites More sharing options...
bernd670 Posted April 5, 2018 Share Posted April 5, 2018 Hello, use ContinueLoop For $i = 0 To UBound($ComputerName) - 1 $iFileExists = FileExists("\\" & $ComputerName[$i] & "\C$\Temp\Agent15\install_agent.bat") If Not $iFileExists Then ContinueLoop FileWriteLine($LogFile, @MON & "/" & @MDAY & "/" & @YEAR & " - " & @HOUR & ":" & @MIN & ":" & @SEC & " Running installer") ;I'm doing more stuff if the bat file exist. Next greetingsbernd I hacked 127.0.0.1 -> 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