{"id":4641,"date":"2021-11-11T08:06:59","date_gmt":"2021-11-11T08:06:59","guid":{"rendered":"https:\/\/lgildv5i97.onrocket.site\/answers\/?post_type=question&#038;p=4641"},"modified":"2021-11-11T08:09:14","modified_gmt":"2021-11-11T08:09:14","slug":"batch-to-detect-unix-and-windows-line-endings","status":"publish","type":"question","link":"https:\/\/computing.net\/answers\/programming\/batch-to-detect-unix-and-windows-line-endings\/24948.html","title":{"rendered":"Batch To Detect Unix And Windows Line Endings"},"content":{"rendered":"<p>Hi,<\/p>\n<p>I am stuck with my windows batch script \ud83d\ude41<\/p>\n<p>I want to check if a text file contains unix style line endings (LF)<br \/>\nand windows style line endings (CR LF).<\/p>\n<p>I am able to detect windows style line endings with this command:<\/p>\n<p>for \/f &#8220;tokens=*&#8221; %%t in ( &#8216;findstr \/r &#8220;$&#8221; test.txt ) do set win_line_ending=1<\/p>\n<p>But I don&#8217;t know how to detect the unix style line ending. I only want to use windows commands (no extra tools).<\/p>\n<p>Help is really appreciated!<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"iawp_total_views":5},"question-category":[55],"question_tags":[],"class_list":["post-4641","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\/4641","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=4641"}],"wp:attachment":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/media?parent=4641"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question-category?post=4641"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question_tags?post=4641"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}