{"id":5075,"date":"2021-11-12T10:25:47","date_gmt":"2021-11-12T10:25:47","guid":{"rendered":"https:\/\/lgildv5i97.onrocket.site\/answers\/?post_type=question&#038;p=5075"},"modified":"2021-11-12T10:26:13","modified_gmt":"2021-11-12T10:26:13","slug":"batch-file-to-extract-address-from-url-file","status":"publish","type":"question","link":"https:\/\/computing.net\/answers\/programming\/batch-file-to-extract-address-from-url-file\/27904.html","title":{"rendered":"Batch File To Extract Address From .Url File"},"content":{"rendered":"<p>Google Chrome doesn&#8217;t handle .url files unless it&#8217;s set as the default browser. I don&#8217;t want to set it as the default browser but I still want the option to open .url files with Chrome using a batch+registry command.<br \/>\nI made this batch file to search each line a .url until it finds the URL= string and then launch chrome with the address on that line. It works for some .url files and doesn&#8217;t for others. The problem is all .url files are not alike. Some have 2 lines some have 4 lines some have 12 lines. The batch files doesn&#8217;t seem to be going through all of the lines. The script doesn&#8217;t work right or it isn&#8217;t nested properly.<\/p>\n<p>@Echo Off<br \/>\nSETLOCAL<br \/>\n(FOR \/L %%i IN (1,1,9) DO SET \/P url=) &lt; %1<br \/>\nIf \/I %url:~0,4%=URL START %LOCALAPPDATA%\\Google\\Chrome\\Application\\chrome.exe &#8211;new-tab-page-1 &#8220;%url:~4%&#8221;<br \/>\nENDLOCAL<\/p>\n<p>Line 1-9 is usually where the URL= address is so I used that as the range.<br \/>\nSome help would be 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":6},"question-category":[55],"question_tags":[],"class_list":["post-5075","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\/5075","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=5075"}],"wp:attachment":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/media?parent=5075"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question-category?post=5075"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question_tags?post=5075"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}