{"id":14984,"date":"2021-12-17T14:17:43","date_gmt":"2021-12-17T14:17:43","guid":{"rendered":"https:\/\/lgildv5i97.onrocket.site\/answers\/?post_type=question&#038;p=14984"},"modified":"2021-12-17T14:18:12","modified_gmt":"2021-12-17T14:18:12","slug":"how-to-skip-a-line-in-a-batch-file","status":"publish","type":"question","link":"https:\/\/computing.net\/answers\/programming\/how-to-skip-a-line-in-a-batch-file\/26694.html","title":{"rendered":"How To Skip a Line In a Batch File"},"content":{"rendered":"<p>I&#8217;m currently using a script made by someone else from this forum (thank you whoever you are) and am in need of help. I&#8217;m using the script to point psshutdown to shutdown multiple computers by using the ip address that the script creates. For some reason though, if the ping fails to communicate with the computer, it will list the local ip address in the list. Then when psshutdown uses that list to send the shutdown command, it shuts down the local machine. How can I skip the lines that contain said ip address, or how can I go about not adding that address to the output file?<br \/>\nThis is the script:<br \/>\n@echo off<br \/>\nif exist X:\\output.txt del X:\\output.txt else continue<br \/>\nset ComputerList=X:\\FQDNs.txt<\/p>\n<p>setlocal enabledelayedexpansion<\/p>\n<p>for \/f &#8220;usebackq tokens=*&#8221; %%A in (&#8220;%X:\\FQDNs.txt%&#8221;) do (<br \/>\nfor \/f &#8220;tokens=3&#8221; %%B in (&#8216;ping -4 -n 1 -l 1 %%A ^|findstr Reply&#8217;) do (<br \/>\nset IPadd=%%B<br \/>\necho !IPadd:~0,-1!&gt;&gt;X:\\output.txt<br \/>\n))<\/p>\n<p>X:\\psshutdown.exe -c -t 900 @X:\\output.txt<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"iawp_total_views":31},"question-category":[55],"question_tags":[],"class_list":["post-14984","question","type-question","status-publish","hentry","question-category-programming"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question\/14984","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question"}],"about":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/types\/question"}],"author":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/comments?post=14984"}],"wp:attachment":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/media?parent=14984"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question-category?post=14984"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question_tags?post=14984"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}