{"id":3319,"date":"2021-11-03T12:38:17","date_gmt":"2021-11-03T12:38:17","guid":{"rendered":"https:\/\/lgildv5i97.onrocket.site\/answers\/?post_type=question&#038;p=3319"},"modified":"2021-11-03T12:41:04","modified_gmt":"2021-11-03T12:41:04","slug":"batch-to-ping-host-if-present-proceed","status":"publish","type":"question","link":"https:\/\/computing.net\/answers\/programming\/batch-to-ping-host-if-present-proceed\/20726.html","title":{"rendered":"Batch To Ping Host If Present Proceed"},"content":{"rendered":"<p>I&#8217;m trying to create batch file to connect to a home<br \/>\nnetwork appliance storage (NAS). How do I make it to<br \/>\nfirst ping if NAS is present to &#8220;net use: &#8220;, if not<br \/>\npresent echo NAS is unreachable?<\/p>\n<p>@echo off<br \/>\nping -n 1 192.168.1.226 rem My_NAS<br \/>\nif ALIVE goto :CONNECT<br \/>\nif UNREACHABLE goto :END<\/p>\n<p>:CONNECT<\/p>\n<p>if exist p: goto drivefound0 else<br \/>\ngoto end<br \/>\n:drivefound0<br \/>\nnet use p: \/del<br \/>\n:end<\/p>\n<p>if exist s: goto drivefound1<br \/>\ngoto end<br \/>\n:drivefound1<br \/>\nnet use s: \/del<br \/>\n:end<\/p>\n<p>net use p: \\\\airnas\\user1 password1 \/user:airnas\\user1<br \/>\nnet use s: \\\\airnas\\public<\/p>\n<p>:END<br \/>\necho DONE!<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"iawp_total_views":1},"question-category":[55],"question_tags":[],"class_list":["post-3319","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\/3319","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\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/comments?post=3319"}],"wp:attachment":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/media?parent=3319"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question-category?post=3319"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question_tags?post=3319"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}