{"id":551,"date":"2025-03-02T18:24:14","date_gmt":"2025-03-02T10:24:14","guid":{"rendered":"https:\/\/telaker.cn\/?p=551"},"modified":"2025-03-02T18:29:04","modified_gmt":"2025-03-02T10:29:04","slug":"windows_bat_script","status":"publish","type":"post","link":"https:\/\/telaker.cn\/index.php\/2025\/03\/02\/windows_bat_script\/","title":{"rendered":"windows\u5feb\u901f\u5f00\u5173\u7f51\u7edc\u63a5\u53e3\u7684\u811a\u672c"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u65b9\u6848\u4e00\uff1a\u8f93\u51651\u5173\u95ed\u4ee5\u592a\u7f51 1\u5e76\u6253\u5f00WLAN\uff0c\u8f93\u51652\u76f8\u53cd<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>@echo off\nchcp 65001 &gt;nul\n:: \u81ea\u52a8\u7533\u8bf7\u7ba1\u7406\u5458\u6743\u9650\n&gt;nul 2&gt;&amp;1 \"%SYSTEMROOT%\\system32\\cacls.exe\" \"%SYSTEMROOT%\\system32\\config\\system\"\nif '%errorlevel%' NEQ '0' (\n    echo Requesting admin privileges...\n    goto UACPrompt\n) else ( goto gotAdmin )\n:UACPrompt\necho Set UAC = CreateObject^(\"Shell.Application\"^) &gt; \"%temp%\\getadmin.vbs\"\necho UAC.ShellExecute \"%~s0\", \"\", \"\", \"runas\", 1 &gt;&gt; \"%temp%\\getadmin.vbs\"\n\"%temp%\\getadmin.vbs\" &amp; exit \/B\n:gotAdmin\n\n:: \u4e3b\u83dc\u5355\n:menu\ncls\necho Network Interface Manager\necho --------------------------\necho 1. \u56fd\u5916 Disable Ethernet 1 and Enable WLAN\necho 2. \u56fd\u5185 Enable Ethernet 1 and Disable WLAN\necho 3. Exit\nset \/p choice=Enter number (1-3): \nif \"%choice%\"==\"1\" goto disableEthernetEnableWLAN\nif \"%choice%\"==\"2\" goto enableEthernetDisableWLAN\nif \"%choice%\"==\"3\" exit\ngoto menu\n\n:disableEthernetEnableWLAN\nnetsh interface set interface name=\"\u4ee5\u592a\u7f51\" admin=disable\nnetsh interface set interface name=\"WLAN\" admin=enable\necho Ethernet 1 disabled and WLAN enabled!\ntimeout \/t 2 &gt;nul\ngoto menu\n\n:enableEthernetDisableWLAN\nnetsh interface set interface name=\"\u4ee5\u592a\u7f51\" admin=enable\nnetsh interface set interface name=\"WLAN\" admin=disable\necho Ethernet 1 enabled and WLAN disabled!\ntimeout \/t 2 &gt;nul\ngoto menu<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u65b9\u6848\u4e8c\uff1a\u901a\u8fc7\u4e24\u5c42\u547d\u4ee4\uff0c\u63a7\u5236\u4e0d\u540c\u7684\u7f51\u7edc\u63a5\u53e3<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>@echo off\nchcp 65001 &gt;nul\n:: \u81ea\u52a8\u7533\u8bf7\u7ba1\u7406\u5458\u6743\u9650\n&gt;nul 2&gt;&amp;1 \"%SYSTEMROOT%\\system32\\cacls.exe\" \"%SYSTEMROOT%\\system32\\config\\system\"\nif '%errorlevel%' NEQ '0' (\n    echo Requesting admin privileges...\n    goto UACPrompt\n) else ( goto gotAdmin )\n:UACPrompt\necho Set UAC = CreateObject^(\"Shell.Application\"^) &gt; \"%temp%\\getadmin.vbs\"\necho UAC.ShellExecute \"%~s0\", \"\", \"\", \"runas\", 1 &gt;&gt; \"%temp%\\getadmin.vbs\"\n\"%temp%\\getadmin.vbs\" &amp; exit \/B\n:gotAdmin\n\n:: \u4e3b\u83dc\u5355\n:menu\ncls\necho Network Interface Manager\necho --------------------------\necho 1. \u4ee5\u592a\u7f51 1\necho 2. \u4ee5\u592a\u7f51 2\necho 3. WLAN\necho 4. Exit\nset \/p choice=Enter number (1-4): \nif \"%choice%\"==\"1\" set interface=\"\u4ee5\u592a\u7f51\" &amp;&amp; goto operation\nif \"%choice%\"==\"2\" set interface=\"\u4ee5\u592a\u7f51 2\" &amp;&amp; goto operation\nif \"%choice%\"==\"3\" set interface=\"WLAN\" &amp;&amp; goto operation\nif \"%choice%\"==\"4\" exit\ngoto menu\n\n:: \u64cd\u4f5c\u83dc\u5355\n:operation\ncls\necho Selected Interface: %interface%\necho --------------------------\necho 1. Disable\necho 2. Enable\necho 3. Back\necho 4. Exit\nset \/p action=Choose action (1-4): \nif \"%action%\"==\"1\" (netsh interface set interface %interface% admin=disable &amp;&amp; echo %interface% disabled!)\nif \"%action%\"==\"2\" (netsh interface set interface %interface% admin=enable &amp;&amp; echo %interface% enabled!)\nif \"%action%\"==\"3\" goto menu\nif \"%choice%\"==\"4\" exit\ntimeout \/t 1 &gt;nul\ngoto menu<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u5c0f\u610f\u5916<\/h2>\n\n\n\n<p>echo\u547d\u4ee4\u4e2d\u4ec5\u4f5c\u4e3a\u8f93\u51fa\uff0c\u4e0b\u9762\u7684\u9519\u8bef\u4e0d\u5e94\u8be5\u5440\uff01<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/telaker.cn\/wp-content\/uploads\/2025\/03\/image.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"930\" height=\"200\" data-original=\"https:\/\/telaker.cn\/wp-content\/uploads\/2025\/03\/image.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" class=\"wp-image-553\"  sizes=\"auto, (max-width: 930px) 100vw, 930px\" \/><\/div><\/figure>\n\n\n\n<p>\u6253\u5f00\u6267\u884c\u8ffd\u8e2a\uff0c\u9010\u6b65\u5206\u6790\u3002\u53d1\u73b0\u6267\u884c\u65f6\uff0c\u5176\u4e2d\u7684\u4e00\u4e2aecho\u88ab\u541e\u4e86\uff1f\uff1f\uff1f\uff01\uff01<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/telaker.cn\/wp-content\/uploads\/2025\/03\/image-1.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"761\" height=\"453\" data-original=\"https:\/\/telaker.cn\/wp-content\/uploads\/2025\/03\/image-1.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" class=\"wp-image-554\"  sizes=\"auto, (max-width: 761px) 100vw, 761px\" \/><\/div><\/figure>\n\n\n\n<p>\u601d\u8003\u539f\u56e0<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u56e0\u5b58\u5728\u4e2d\u6587\u5b57\u7b26\uff0c\u6587\u672c\u683c\u5f0f\u6709\u95ee\u9898\uff1fUTF-8\u683c\u5f0f\uff0c\u6ca1\u6bdb\u75c5\u5440\uff01<\/li>\n\n\n\n<li>echo\u8bed\u6cd5\u4e0d\u5bf9\uff1f\u8fd9\u4e5f\u4e0d\u662f\u5440\uff01<\/li>\n\n\n\n<li>\u4ee3\u7801\u5176\u4ed6\u90e8\u5206\u7684\u5e72\u6270\uff1f\u5176\u4ed6\u5730\u65b9\u6ca1\u4e8b\u5440\uff01<\/li>\n\n\n\n<li>\uff1f\uff1f\uff1f\uff1f<\/li>\n<\/ul>\n\n\n\n<p>\u6700\u540e\u53d1\u73b0\uff0c\u8fd9\u4e00\u884c\u4e2d<strong>\u6c49\u5b57\u4e2a\u6570\u4e3a\u5076\u6570<\/strong>\u65f6\uff08\u6216\u662f\u6c49\u5b57\u540e\u9762\u968f\u610f\u52a0\u4e0a\u53ef\u89c1\u4e24\u4e2a\u5b57\u7b26\uff09\uff0c\u8fd0\u884c\u6b63\u5e38\uff01\u554a\uff01\uff01\uff01\uff08\u65e0\u5948\uff0c\u9119\u4eba\u4e0d\u624d\uff0c\u4e0d\u8ddf\u4f60\u5728\u8fd9\u8017\uff0c\u8d70\u4e86\u8d70\u4e86\uff09<\/p>\n\n\n\n<p>\u5176\u5b9e\uff0c\u6211\u7684\u786c\u4ef6\u5c31\u53eb\u201c\u4ee5\u592a\u7f51\u201d\uff0c\u7531\u4e8e\u4e0a\u9762\u7684\u539f\u56e0\uff0c\u4fbf\u4fee\u6539\u6210\u201c\u4ee5\u592a\u7f51 1\u201d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u65b9\u6848\u4e00\uff1a\u8f93\u51651\u5173\u95ed\u4ee5\u592a\u7f51 1\u5e76\u6253\u5f00WLAN\uff0c\u8f93\u51652\u76f8\u53cd \u65b9\u6848\u4e8c\uff1a\u901a\u8fc7\u4e24\u5c42\u547d\u4ee4\uff0c\u63a7\u5236\u4e0d\u540c\u7684\u7f51\u7edc\u63a5\u53e3 \u5c0f\u610f\u5916 ec [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[50],"tags":[51],"class_list":["post-551","post","type-post","status-publish","format-standard","hentry","category-windows","tag-bat"],"_links":{"self":[{"href":"https:\/\/telaker.cn\/index.php\/wp-json\/wp\/v2\/posts\/551","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/telaker.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/telaker.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/telaker.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/telaker.cn\/index.php\/wp-json\/wp\/v2\/comments?post=551"}],"version-history":[{"count":0,"href":"https:\/\/telaker.cn\/index.php\/wp-json\/wp\/v2\/posts\/551\/revisions"}],"wp:attachment":[{"href":"https:\/\/telaker.cn\/index.php\/wp-json\/wp\/v2\/media?parent=551"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/telaker.cn\/index.php\/wp-json\/wp\/v2\/categories?post=551"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/telaker.cn\/index.php\/wp-json\/wp\/v2\/tags?post=551"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}