{"id":5811,"date":"2021-11-17T04:38:57","date_gmt":"2021-11-17T04:38:57","guid":{"rendered":"https:\/\/lgildv5i97.onrocket.site\/answers\/?post_type=question&#038;p=5811"},"modified":"2021-11-17T04:39:24","modified_gmt":"2021-11-17T04:39:24","slug":"help-reading-columns-in-a-csv-file-with-vbs","status":"publish","type":"question","link":"https:\/\/computing.net\/answers\/programming\/help-reading-columns-in-a-csv-file-with-vbs\/28646.html","title":{"rendered":"Help Reading Columns In A Csv File With Vbs"},"content":{"rendered":"<p>Here is my present script. it reads a single column file of ip addresses and pings each one.<br \/>\nI&#8217;d like to have 2 columns in a csv file. ip address,hostname Have it ping the ip, but print the hostname. Your help would be greatly appreciated.<\/p>\n<p>Set InputFile = fso.OpenTextFile(&#8220;h:\\usr\\bin\\MachineList.Txt&#8221;)<br \/>\nDo While Not (InputFile.atEndOfStream)<br \/>\nHostName = InputFile.ReadLine<br \/>\nSet WshShell = WScript.CreateObject(&#8220;WScript.Shell&#8221;)<br \/>\nPing = WshShell.Run(&#8220;ping -n 1 &#8221; &amp; HostName, 0, True)<br \/>\nobjExcel.Cells(intRow, 1).Value = UCase(HostName)<br \/>\nSelect Case Ping<br \/>\nCase 0 objExcel.Cells(intRow, 2).Value = &#8220;On Line&#8221;<br \/>\nCase 1 objExcel.Cells(intRow, 2).Value = &#8220;Off Line&#8221;<br \/>\nEnd Select<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"iawp_total_views":3},"question-category":[55],"question_tags":[],"class_list":["post-5811","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\/5811","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=5811"}],"wp:attachment":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/media?parent=5811"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question-category?post=5811"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question_tags?post=5811"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}