

{"id":207,"date":"2022-07-25T13:35:57","date_gmt":"2022-07-25T05:35:57","guid":{"rendered":"https:\/\/www.01j.top\/?p=207"},"modified":"2022-07-25T13:35:58","modified_gmt":"2022-07-25T05:35:58","slug":"bat%e8%84%9a%e6%9c%acwindows%e6%89%b9%e5%a4%84%e7%90%86%e5%9f%ba%e7%a1%80%e6%95%99%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/www.01j.top\/?p=207","title":{"rendered":"bat\u811a\u672cWindows\u6279\u5904\u7406\u57fa\u7840\u6559\u7a0b"},"content":{"rendered":"\n<p class=\"is-style-text-indent-default\">\u76ee\u5f55\u5e38\u89c1\u7528\u9014bat\u547d\u4ee4\u901f\u67e5\u5e38\u7528\u53c2\u6570echo\u6ce8\u91caRem\u4f7f\u7528::\u58f0\u660edir\uff1a\u83b7\u53d6\u76ee\u5f55\u5185\u5bb9\uff1a\u5c06\u8f93\u51fa\u91cd\u5b9a\u5411\u5230\u6587\u4ef6\u53d8\u91cf\u547d\u4ee4\u884c\u53c2\u6570set\u547d\u4ee4\u5b57\u7b26\u4e32\u6570\u503c\u5c40\u90e8\u53d8\u91cfvs\u5168\u5c40\u53d8\u91cf\u73af\u5883\u53d8\u91cf\u8f93\u51fa\u5b57\u7b26\u4e32\u521b\u5efa\u7a7a\u5b57\u7b26&#8230;<\/p>\n\n\n\n<h5>\u76ee\u5f55<\/h5>\n\n\n\n<ul><li>\u5e38\u89c1\u7528\u9014<\/li><li>bat\u547d\u4ee4\u901f\u67e5<ul><li>\u5e38\u7528\u53c2\u6570<\/li><\/ul><\/li><li>echo<ul><\/ul><\/li><li>\u6ce8\u91ca<ul><li>Rem<\/li><li>\u4f7f\u7528::\u58f0\u660e<\/li><\/ul><\/li><li>dir \uff1a\u83b7\u53d6\u76ee\u5f55\u5185\u5bb9<ul><\/ul><\/li><li>&gt; \uff1a\u5c06\u8f93\u51fa\u91cd\u5b9a\u5411\u5230\u6587\u4ef6<ul><\/ul><\/li><li>\u53d8\u91cf<ul><li>\u547d\u4ee4\u884c\u53c2\u6570<\/li><li>set\u547d\u4ee4<ul><li>\u5b57\u7b26\u4e32<\/li><li>\u6570\u503c<\/li><\/ul><\/li><\/ul><\/li><li>\u5c40\u90e8\u53d8\u91cf vs \u5168\u5c40\u53d8\u91cf<ul><\/ul><\/li><li>\u73af\u5883\u53d8\u91cf\u8f93\u51fa<ul><\/ul><\/li><li>\u5b57\u7b26\u4e32<ul><li>\u521b\u5efa<ul><\/ul><\/li><li>\u7a7a\u5b57\u7b26\u4e32<ul><\/ul><\/li><li>\u5b57\u7b26\u4e32\u62fc\u63a5<ul><\/ul><\/li><li>\u5b57\u7b26\u4e32\u957f\u5ea6<ul><\/ul><\/li><li>\u8f6cint<ul><\/ul><\/li><li>\u622a\u53d6<ul><\/ul><\/li><li>\u53f3\u5bf9\u9f50<ul><\/ul><\/li><li>\u5220\u9664\u5b57\u7b26\u4e32<ul><\/ul><\/li><li>\u5220\u9664\u4e24\u7aef(\u4fdd\u7559\u4e2d\u95f4)<ul><\/ul><\/li><li>\u5220\u9664\u7a7a\u683c:=<ul><\/ul><\/li><li>\u66ff\u6362<ul><\/ul><\/li><\/ul><\/li><li>\u6570\u7ec4<ul><li>\u521b\u5efa<ul><\/ul><\/li><li>\u8bbf\u95ee<ul><\/ul><\/li><li>\u4fee\u6539<ul><\/ul><\/li><li>\u8fed\u4ee3<ul><\/ul><\/li><li>\u6570\u7ec4\u957f\u5ea6<ul><\/ul><\/li><li>\u7ed3\u6784\u4f53<ul><\/ul><\/li><\/ul><\/li><li>if\u8bed\u53e5<ul><li>if defined \uff1a\u53d8\u91cf\u662f\u5426\u5b58\u5728<ul><\/ul><\/li><li>if exists\uff1a\u6587\u4ef6\u662f\u5426\u5b58\u5728<ul><\/ul><\/li><li>if errorlevel\uff1a\u6d4b\u8bd5\u8fd0\u884c\u7684\u6700\u540e\u4e00\u4e2a\u547d\u4ee4\u7684\u9000\u51fa\u4ee3\u7801<ul><\/ul><\/li><\/ul><\/li><li>for\u8bed\u53e5<ul><li>\/d<ul><\/ul><\/li><li>\/r<ul><\/ul><\/li><li>\/l<ul><\/ul><\/li><li>\/f<ul><\/ul><\/li><\/ul><\/li><li>goto\u8bed\u53e5<ul><\/ul><\/li><li>\u8fd0\u7b97\u7b26<ul><li>\u5173\u7cfb\u8fd0\u7b97\u7b26<ul><\/ul><\/li><\/ul><\/li><li>\u7cfb\u7edf\u65e5\u671f<ul><li>\u65e5\u671f\u683c\u5f0f\u5316<ul><\/ul><\/li><\/ul><\/li><li>\u7cfb\u7edf\u65f6\u95f4<ul><\/ul><\/li><li>\u8f93\u5165\u8f93\u51fa<ul><li>\u91cd\u5b9a\u5411<ul><\/ul><\/li><\/ul><\/li><li>\u51fd\u6570<ul><li>\u8c03\u7528 call :function_name<ul><\/ul><\/li><\/ul><\/li><li>\u8fdb\u7a0b<ul><li>\u67e5\u770b\u8fdb\u7a0b\u5217\u8868TASKLIST<ul><\/ul><\/li><li>\u7ec8\u6b62\u8fdb\u7a0b<ul><\/ul><\/li><li>\u542f\u52a8\u8fdb\u7a0b<ul><\/ul><\/li><\/ul><\/li><li>\u522b\u540d<ul><li>doskey \u522b\u540d\u7ba1\u7406<ul><li>\u521b\u5efa<\/li><li>\u5220\u9664<\/li><\/ul><\/li><\/ul><\/li><li>\u7ba1\u9053\uff08|\uff09<ul><\/ul><\/li><\/ul>\n\n\n\n<p class=\"is-style-text-indent-default\">\u6279\u5904\u7406<a href=\"http:\/\/www.cppcns.com\/jiaoben\/\" target=\"_blank\" rel=\"noreferrer noopener\">\u811a\u672c<\/a>\u6587\u4ef6\u5177\u6709\u7279\u6b8a\u7684\u6269\u5c55\u540dBAT\u6216CMD\uff0c\u8fd9\u79cd\u7c7b\u578b\u7684\u6587\u4ef6\u901a\u8fc7\u79f0\u4e3a**\u547d\u4ee4\u89e3\u91ca\u5668\uff08cmd.exe\uff09**\u7684\u7cfb\u7edf\u6587\u4ef6\u63d0\u4f9b\u7684\u63a5\u53e3\uff08shell\uff09\u6765\u8bc6\u522b\u548c\u6267\u884c\u3002<\/p>\n\n\n\n<h2 id=\"h2-0\">\u5e38\u89c1\u7528\u9014<\/h2>\n\n\n\n<ul><li>\u4e3a\u4e0d\u540c\u7684\u76ee\u7684\u8bbe\u7f6e\u670d\u52a1\u5668<\/li><li>\u81ea\u52a8\u7ba1\u7406\u6d3b\u52a8\u548c\u65e5\u5fd7\uff0c\u5982\u5220\u9664\u4e0d\u9700\u8981\u7684\u6587\u4ef6\u6216\u65e5\u5fd7\u6587\u4ef6<\/li><li>\u81ea\u52a8\u5c06\u5e94\u7528\u7a0b\u5e8f\u4ece\u4e00\u4e2a\u73af\u5883\u90e8\u7f72\u5230\u53e6\u4e00\u4e2a\u73af\u5883\u3002<\/li><li>\u7acb\u5373\u5728\u5404\u79cd\u673a\u5668\u4e0a\u5b89\u88c5\u7a0b\u5e8f\u3002<\/li><\/ul>\n\n\n\n<h2 id=\"h2-1\">bat\u547d\u4ee4\u901f\u67e5<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u547d\u4ee4<\/th><th>\u5907\u6ce8<\/th><\/tr><\/thead><tbody><tr><td>VER<\/td><td>\u663e\u793a\u6b63\u5728\u4f7f\u7528\u7684MS-DOS\u7684\u7248\u672c<\/td><\/tr><tr><td>ASSOC<\/td><td>\u8fd9\u662f\u5c06\u6269\u5c55\u540d\u4e0e\u6587\u4ef6\u7c7b\u578b(FTYPE)\u76f8\u5173\u8054\u7684\u6279\u5904\u7406\u547d\u4ee4\uff0c\u663e\u793a\u73b0\u6709\u5173\u8054\u6216\u5220\u9664\u5173\u8054<\/td><\/tr><tr><td>cd<\/td><td>\u66f4\u6539\u4e0d\u540c\u7684\u76ee\u5f55\uff0c\u6216\u663e\u793a\u5f53\u524d\u76ee\u5f55<\/td><\/tr><tr><td>CLS<\/td><td>\u6e05\u5c4f<\/td><\/tr><tr><td>COPY<\/td><td>\u6587\u4ef6\u590d\u5236<\/td><\/tr><tr><td>DEL<\/td><td>\u5220\u9664\u6587\u4ef6<\/td><\/tr><tr><td>DIR<\/td><td>\u5217\u51fa\u76ee\u5f55\u5185\u5bb9<\/td><\/tr><tr><td>DATE<\/td><td>\u7cfb\u7edf\u65e5\u671f<\/td><\/tr><tr><td>ECHO<\/td><td>\u663e\u793a\u6d88\u606f\uff0c\u6216\u6253\u5f00\u3001\u5173\u95ed\u547d\u4ee4\u56de\u663e<\/td><\/tr><tr><td>EXIT<\/td><td>\u9000\u51faDOS\u63a7\u5236\u53f0<\/td><\/tr><tr><td>MD<\/td><td>\u521b\u5efa\u76ee\u5f55<\/td><\/tr><tr><td>MOVE<\/td><td>\u79fb\u52a8\u6587\u4ef6\u6216\u76ee\u5f55<\/td><\/tr><tr><td>PATH<\/td><td>\u663e\u793a\u6216\u8bbe\u7f6e\u8def\u5f84\u53d8\u91cf<\/td><\/tr><tr><td>PAUSE<\/td><td>\u7b49\u5f85\u8f93\u5165<\/td><\/tr><tr><td>PROMPT<\/td><td>\u7528\u4e8e\u66f4\u6539\u6216\u91cd\u7f6ecmd.exe\u63d0\u793a\u7b26<\/td><\/tr><tr><td>RD<\/td><td>\u5220\u9664\u76ee\u5f55\uff08\u9700\u4e3a\u7a7a\uff09<\/td><\/tr><tr><td>REN<\/td><td>\u91cd\u547d\u540d\u6587\u4ef6\u548c\u76ee\u5f55<\/td><\/tr><tr><td>REM<\/td><td>\u6ce8\u91ca<\/td><\/tr><tr><td>START<\/td><td>\u5728\u65b0\u7a97\u53e3\u4e2d\u542f\u52a8\u7a0b\u5e8f\uff0c\u6216\u6253\u5f00\u6587\u6863<\/td><\/tr><tr><td>TIME<\/td><td>\u8bbe\u7f6e\u6216\u663e\u793a\u65f6\u95f4<\/td><\/tr><tr><td>TYPE<\/td><td>\u5c06\u6587\u4ef6\u6216\u6587\u4ef6\u7684\u5185\u5bb9\u6253\u5370\u5230\u8f93\u51fa\u4e2d<\/td><\/tr><tr><td>VOL<\/td><td>\u663e\u793a\u5377\u6807<\/td><\/tr><tr><td>ATTRIB<\/td><td>\u663e\u793a\u6216\u8bbe\u7f6e\u5f53\u524d\u76ee\u5f55\u4e2d\u7684\u6587\u4ef6\u7684\u5c5e\u6027<\/td><\/tr><tr><td>CHKDSK<\/td><td>\u68c0\u67e5\u78c1\u76d8\u662f\u5426\u6709\u95ee\u9898<\/td><\/tr><tr><td>CHOICE<\/td><td>\u4e3a\u7528\u6237\u63d0\u4f9b\u4e86\u4e00\u4e2a\u9009\u9879\u5217\u8868<\/td><\/tr><tr><td>CMD<\/td><td>\u8c03\u7528\u53e6\u4e00\u4e2a\u547d\u4ee4\u63d0\u793a\u7b26\u5b9e\u4f8b<\/td><\/tr><tr><td>COMP<\/td><td>\u6839\u636e\u6587\u4ef6\u5927\u5c0f\u6bd4\u8f832\u4e2a\u6587\u4ef6<\/td><\/tr><tr><td>CONVERT<\/td><td>\u5c06\u5377\u4eceFAT16\u6216FAT32\u6587\u4ef6\u7cfb\u7edf\u8f6c\u6362\u4e3aNTFS\u6587\u4ef6\u7cfb\u7edf<\/td><\/tr><tr><td>DRIVERQUERY<\/td><td>\u663e\u793a\u6240\u6709\u5df2\u5b89\u88c5\u7684\u8bbe\u5907\u9a71\u52a8\u7a0b\u5e8f\u53ca\u5176\u5c5e\u6027<\/td><\/tr><tr><td>EXPAND<\/td><td>\u4ece\u538b\u7f29\u7684.cab\u538b\u7f29\u6587\u4ef6\u4e2d\u63d0\u53d6\u6587\u4ef6<\/td><\/tr><tr><td>FIND<\/td><td>\u5728\u6587\u4ef6\u6216\u8f93\u5165\u4e2d\u641c\u7d22\u5b57\u7b26\u4e32\uff0c\u8f93\u51fa\u5339\u914d\u7684\u884c<\/td><\/tr><tr><td>FORMAT<\/td><td>\u5c06\u78c1\u76d8\u683c\u5f0f\u5316\u4e3a\u4f7f\u7528Windows\u652f\u6301\u7684\u6587\u4ef6\u7cfb\u7edf(\u5982FAT\uff0cFAT32\u6216NTFS)\uff0c\u4ece\u800c\u8986\u76d6\u78c1\u76d8\u7684\u5148\u524d\u5185\u5bb9<\/td><\/tr><tr><td>HELP<\/td><td>\u663e\u793aWindows\u63d0\u4f9b\u7684\u547d\u4ee4\u7684\u5217\u8868<\/td><\/tr><tr><td>IPCONFIG<\/td><td>\u663e\u793aWindows IP\u914d\u7f6e\u3002\u663e\u793a\u8fde\u63a5\u7684\u914d\u7f6e\u548c\u8fde\u63a5\u7684\u540d\u79f0<\/td><\/tr><tr><td>LABEL<\/td><td>\u6dfb\u52a0\uff0c\u8bbe\u7f6e\u6216\u5220\u9664\u78c1\u76d8\u6807\u7b7e<\/td><\/tr><tr><td>MORE<\/td><td>\u4e00\u6b21\u663e\u793a\u4e00\u4e2a\u6216\u591a\u4e2a\u6587\u4ef6\u7684\u5185\u5bb9<\/td><\/tr><tr><td>NET<\/td><td>\u6839\u636e\u4f7f\u7528\u7684\u547d\u4ee4\u63d0\u4f9b\u5404\u79cd\u7f51\u7edc\u670d\u52a1<\/td><\/tr><tr><td>PING<\/td><td>\u901a\u8fc7\u7f51\u7edc\u5c06ICMP\/IP \u201c\u56de\u663e\u201d\u53d1\u9001\u5230\u6307\u5b9a\u7684\u5730\u5740\u7684\u5305<\/td><\/tr><tr><td>SHUTDOWN<\/td><td>\u5173\u95ed\u8ba1\u7b97\u673a\uff0c\u6216\u8005\u6ce8\u9500\u5f53\u524d\u7528\u6237<\/td><\/tr><tr><td>SORT<\/td><td>\u4ece\u6e90\u6587\u4ef6\u83b7\u53d6\u8f93\u5165\uff0c\u5e76\u6309\u5b57\u6bcd\u987a\u5e8f\u6392\u5e8f\u5176\u5185\u5bb9\uff0c\u4eceA\u5230Z\u6216\u4eceZ\u5230A\u3002\u5b83\u5c06\u5728\u63a7\u5236\u53f0\u4e0a\u6253\u5370\u8f93\u51fa<\/td><\/tr><tr><td>SUBST<\/td><td>\u5c06\u9a71\u52a8\u5668\u53f7\u5206\u914d\u7ed9\u672c\u5730\u6587\u4ef6\u5939\uff0c\u663e\u793a\u5f53\u524d\u5206\u914d\u6216\u5220\u9664\u5206\u914d<\/td><\/tr><tr><td>SYSTEMINFO<\/td><td>\u8be5\u6279\u5904\u7406\u547d\u4ee4\u663e\u793a\u8ba1\u7b97\u673a\u53ca\u5176<a href=\"http:\/\/www.cppcns.com\/os\/\" target=\"_blank\" rel=\"noreferrer noopener\">\u64cd\u4f5c\u7cfb\u7edf<\/a>\u7684\u914d\u7f6e<\/td><\/tr><tr><td>TASKKILL<\/td><td>\u8be5\u6279\u5904\u7406\u547d\u4ee4\u7ed3\u675f\u4e00\u4e2a\u6216\u591a\u4e2a\u4efb\u52a1<\/td><\/tr><tr><td>TASKLIST<\/td><td>\u5217\u51fa\u4efb\u52a1\uff0c\u5305\u62ec\u4efb\u52a1\u540d\u79f0\u548c\u8fdb\u7a0b\u6807\u8bc6(PID)<\/td><\/tr><tr><td>XCOPY<\/td><td>\u4ee5\u66f4\u9ad8\u7ea7\u7684\u65b9\u5f0f\u590d\u5236\u6587\u4ef6\u548c\u76ee\u5f55<\/td><\/tr><tr><td>TREE<\/td><td>\u5c06\u5f53\u524d\u76ee\u5f55\u7684\u6240\u6709\u5b50\u76ee\u5f55\u7684\u6811\u663e\u793a\u4e3a\u9012\u5f52\u6216\u6df1\u5ea6\u7684\u4efb\u4f55\u7ea7\u522b<\/td><\/tr><tr><td>FC<\/td><td>\u5217\u51fa\u4e24\u4e2a\u6587\u4ef6\u4e4b\u95f4\u7684\u5b9e\u9645\u5dee\u5f02<\/td><\/tr><tr><td>DISKPART<\/td><td>\u663e\u793a\u548c\u914d\u7f6e\u78c1\u76d8\u5206\u533a\u7684\u5c5e\u6027<\/td><\/tr><tr><td>TITLE<\/td><td>\u8be5\u6279\u5904\u7406\u547d\u4ee4\u8bbe\u7f6e\u63a7\u5236\u53f0\u7a97\u53e3\u4e2d\u663e\u793a\u7684\u6807\u9898<\/td><\/tr><tr><td>SET<\/td><td>\u663e\u793a\u5f53\u524d\u7cfb\u7edf\u4e0a\u7684\u73af\u5883\u53d8\u91cf\u5217\u8868<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 id=\"h3-2\">\u5e38\u7528\u53c2\u6570<\/h3>\n\n\n\n<p class=\"is-style-text-indent-default\"><code>\/L<\/code>\uff1a for\u5faa\u73af\u79fb\u52a8\u8303\u56f4\u7684<code>\/L<\/code>\u53c2\u6570\u7528\u4e8e<strong>\u8fed\u4ee3\u6570\u7ec4<\/strong>\u3002<br><code>\/A<\/code>\uff1a\u6570\u503c<\/p>\n\n\n\n<h2 id=\"h2-3\">echo<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">@echo&nbsp;off<\/pre>\n\n\n\n<ul><li>\u201cecho off\u201d \uff1a\u5173\u95ed\u811a\u672c\u7684\u663e\u793a\uff08\u4e0d\u663e\u793a\u547d\u4ee4\uff09\u3002<\/li><li>\u201c@\u201d \uff1a\u4f7f\u547d\u4ee4\u4e5f\u9002\u7528\u4e8e\u81ea\u5df1\u3002<\/li><\/ul>\n\n\n\n<h2 id=\"h2-4\">\u6ce8\u91ca<\/h2>\n\n\n\n<h3 id=\"h3-5\">Rem<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">Rem&nbsp;Remarks<\/pre>\n\n\n\n<p class=\"is-style-text-indent-default\">\u7a0b\u5e8f\u6267\u884c\u65f6\u5ffd\u7565Rem\u5173\u952e\u5b57\u4e4b\u540e\u7684\u4efb\u4f55\u5185\u5bb9\u3002<\/p>\n\n\n\n<h3 id=\"h3-6\">\u4f7f\u7528::\u58f0\u660e<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">::&nbsp;Remarks<\/pre>\n\n\n\n<h2 id=\"h2-7\">dir \uff1a\u83b7\u53d6\u76ee\u5f55\u5185\u5bb9<\/h2>\n\n\n\n<h2 id=\"h2-8\">&gt; \uff1a\u5c06\u8f93\u51fa\u91cd\u5b9a\u5411\u5230\u6587\u4ef6<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">@echo&nbsp;offRem&nbsp;This&nbsp;is&nbsp;for&nbsp;listing down all the files&nbsp;in&nbsp;the directory&nbsp;Program&nbsp;filesdir&nbsp;\"C:\\Program Files\"&nbsp;&gt;&nbsp;C:\\lists.txtecho&nbsp;\"The program has completed\"<\/pre>\n\n\n\n<h2 id=\"h2-9\">\u53d8\u91cf<\/h2>\n\n\n\n<h3 id=\"h3-10\">\u547d\u4ee4\u884c\u53c2\u6570<code><\/code><\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">rem&nbsp;Test.bat@echo&nbsp;offecho&nbsp;%1echo&nbsp;%2echo&nbsp;%3<\/pre>\n\n\n\n<p class=\"is-style-text-indent-default\">\u8fd0\u884c\u65b9\u5f0f<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Test.bat&nbsp;1&nbsp;2&nbsp;3<\/code><\/pre>\n\n\n\n<h3 id=\"h3-11\">set\u547d\u4ee4<\/h3>\n\n\n\n<p class=\"is-style-text-indent-default\">set \/A variable-name=value<\/p>\n\n\n\n<ul><li>variable-name: \u53d8\u91cf\u7684\u540d\u79f0<\/li><li>value\uff1a\u53d8\u91cf\u503c\u3002<\/li><li>\/A\uff1a\u5982\u679c\u8be5\u503c\u672c\u8d28\u4e0a\u662f\u6570\u503c\uff0c\u5219\u4f7f\u7528\u6b64\u5f00\u5173\u3002<\/li><\/ul>\n\n\n\n<h4>\u5b57\u7b26\u4e32<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">@echo&nbsp;offset&nbsp;message=Hello&nbsp;Worldecho&nbsp;%message%rem&nbsp;\u53d8\u91cf\u9700\u8981\u5305\u542b\u5728\uff05\u7b26\u53f7\u4e2d\u663e\u793a<\/pre>\n\n\n\n<h4>\u6570\u503c<code><\/code><\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">@echo&nbsp;offSET&nbsp;\/A a=5SET&nbsp;\/A b=10SET&nbsp;\/A c=%a%&nbsp;+&nbsp;%b%echo&nbsp;%c%<\/pre>\n\n\n\n<h2 id=\"h2-12\">\u5c40\u90e8\u53d8\u91cf vs \u5168\u5c40\u53d8\u91cf<\/h2>\n\n\n\n<ul><li>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4e3a\u5168\u5c40\u53d8\u91cf\u3002<\/li><li>\u8c03\u7528<code>SETLOCAL<\/code>\u547d\u4ee4\uff0c\u4f7f\u53d8\u91cf\u5c40\u90e8\u5728\u811a\u672c\u7684\u8303\u56f4\u5185\u3002<\/li><li>\u5728\u8c03\u7528SETLOCAL\u4e4b\u540e\uff0c\u4efb\u4f55\u53d8\u91cf\u8d4b\u503c\u5728\u8c03\u7528<code>ENDLOCAL<\/code>\uff0c\u8c03\u7528<code>EXIT<\/code>\uff0c\u6216\u8005\u5f53\u6267\u884c\u5230\u8fbe\u811a\u672c\u4e2d\u7684\u6587\u4ef6\u7ed3\u5c3e(EOF)\u65f6\u90fd\u4f1a\u8fd4\u56de\u3002<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">@echo&nbsp;offset&nbsp;globalvar=5SETLOCALset&nbsp;var=13145set&nbsp;\/A&nbsp;var=%var%&nbsp;+&nbsp;5echo&nbsp;%var%echo&nbsp;%globalvar%ENDLOCAL<\/pre>\n\n\n\n<h2 id=\"h2-13\">\u73af\u5883\u53d8\u91cf\u8f93\u51fa<code><\/code><\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">@echo&nbsp;offecho&nbsp;%<a href=\"http:\/\/www.cppcns.com\/ruanjian\/javabiancheng\/\" target=\"_blank\" rel=\"noreferrer noopener\">java<\/a>_HOME%<\/pre>\n\n\n\n<h2 id=\"h2-14\">\u5b57\u7b26\u4e32<\/h2>\n\n\n\n<h3 id=\"h3-15\">\u521b\u5efa<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">set&nbsp;message=Hello&nbsp;World<\/pre>\n\n\n\n<h3 id=\"h3-16\">\u7a7a\u5b57\u7b26\u4e32<code><\/code><\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">SET a=if&nbsp;[%a%]==[]&nbsp;echo&nbsp;\"String A is empty\"<\/pre>\n\n\n\n<p class=\"is-style-text-indent-default\">\u8981\u68c0\u67e5\u662f\u5426\u5b58\u5728\u7a7a\u5b57\u7b26\u4e32\uff0c\u9700\u8981\u5728<strong>\u65b9\u62ec\u53f7<\/strong>\u4e2d\u5305\u542b\u53d8\u91cf\u540d\uff0c\u5e76\u5c06\u5176\u4e0e\u65b9\u62ec\u53f7\u4e2d\u7684\u503c\u8fdb\u884c\u6bd4\u8f83\u3002<\/p>\n\n\n\n<h3 id=\"h3-17\">\u5b57\u7b26\u4e32\u62fc\u63a5<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">@echo&nbsp;offSET a=HelloSET b=WorldSET&nbsp;\/A d=50SET c=%a%&nbsp;and&nbsp;%b%&nbsp;%d%echo&nbsp;%c%::&nbsp;Hello&nbsp;and&nbsp;World&nbsp;50<\/pre>\n\n\n\n<h3 id=\"h3-18\">\u5b57\u7b26\u4e32\u957f\u5ea6<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">@echo&nbsp;offset&nbsp;str=Hello&nbsp;Worldcall&nbsp;:strLen str strlenecho&nbsp;String&nbsp;is&nbsp;%strlen%&nbsp;characters&nbsp;longexit&nbsp;\/b:strLensetlocal enabledelayedexpansion:strLen_Loop&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;not&nbsp;\"!%1:~%len%!\"==\"\"&nbsp;set&nbsp;\/A len+=1&nbsp;&amp;&nbsp;goto&nbsp;:strLen_Loop(endlocal&nbsp;&amp;&nbsp;set&nbsp;%2=%len%)goto&nbsp;:eof<\/pre>\n\n\n\n<h3 id=\"h3-19\">\u8f6cint<\/h3>\n\n\n\n<p class=\"is-style-text-indent-default\">\u4f7f\u7528set\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u5b57\u7b26\u4e32\u7684\u53d8\u91cf\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528set\u53d8\u91cf\u7684**\/A\u5f00\u5173\u8f6c\u6362\u4e3a\u6574\u6570**\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">@echo&nbsp;offset&nbsp;var=13145set&nbsp;\/A&nbsp;var=%var%&nbsp;+&nbsp;5echo&nbsp;%var%<\/pre>\n\n\n\n<h3 id=\"h3-20\">\u622a\u53d6<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">%variable:~num_chars_to_skip%%variable:~num_chars_to_skip,num_chars_to_keep%<\/pre>\n\n\n\n<p class=\"is-style-text-indent-default\">\u8f93\u51fa\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>Helloworld&nbsp;<br>Hello<\/p><\/blockquote>\n\n\n\n<p class=\"is-style-text-indent-default\"><code>~0,5<\/code>\u7528\u4e8e\u6307\u5b9a\u9700\u8981\u663e\u793a\u7684\u5b57\u7b26<\/p>\n\n\n\n<h3 id=\"h3-21\">\u53f3\u5bf9\u9f50<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">@echo&nbsp;offset&nbsp;x=1000set&nbsp;y=1set&nbsp;y=%y%echo&nbsp;%x%&nbsp;set&nbsp;y=%y:~-4%echo&nbsp;%y%<\/pre>\n\n\n\n<p class=\"is-style-text-indent-default\">\u8f93\u51fa\u200b\u200b\u200b\u200b\u200b\u200b\u200b<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>1000<br>1<\/p><\/blockquote>\n\n\n\n<p class=\"is-style-text-indent-default\">\u4f7f\u7528<code>~-4<\/code>\u9009\u9879\u6765\u8868\u793a\u53ea\u60f3\u663e\u793a\u5b57\u7b26\u4e32y\u7684<strong>\u6700\u540e4\u4e2a\u5b57\u7b26<\/strong>\u3002<\/p>\n\n\n\n<h3 id=\"h3-22\">\u5220\u9664\u5b57\u7b26\u4e32<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">@echo&nbsp;offset&nbsp;str=Batch&nbsp;scripts&nbsp;is&nbsp;easy.&nbsp;It&nbsp;is&nbsp;really easy.echo&nbsp;%str%::&nbsp;\u5220\u9664isset&nbsp;str=%str:is=%echo&nbsp;%str%::&nbsp;Batch&nbsp;scripts easy.&nbsp;It&nbsp;really easy.<\/pre>\n\n\n\n<h3 id=\"h3-23\">\u5220\u9664\u4e24\u7aef(\u4fdd\u7559\u4e2d\u95f4)<code><\/code><\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">@echo&nbsp;offset&nbsp;str=Batch&nbsp;scripts&nbsp;is&nbsp;easy.&nbsp;It&nbsp;is&nbsp;really easyecho&nbsp;%str%&nbsp;set&nbsp;str=%str:~1,-1%echo&nbsp;%str%::&nbsp;atch scripts&nbsp;is&nbsp;easy.&nbsp;It&nbsp;is&nbsp;really eas<\/pre>\n\n\n\n<h3 id=\"h3-24\">\u5220\u9664\u7a7a\u683c<code>:=<\/code><\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">@echo&nbsp;offset&nbsp;str=This&nbsp;string&nbsp;has a lot of spacesecho&nbsp;%str%&nbsp;set&nbsp;str=%str:=%echo&nbsp;%str%::&nbsp;Thisstringhasalotofspaces<\/pre>\n\n\n\n<h3 id=\"h3-25\">\u66ff\u6362<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">@echo&nbsp;offset&nbsp;str=This&nbsp;message needs changed.echo&nbsp;%str%&nbsp;set&nbsp;str=%str:needs=has%echo&nbsp;%str%::&nbsp;This&nbsp;message has changed.<\/pre>\n\n\n\n<h2 id=\"h2-26\">\u6570\u7ec4<\/h2>\n\n\n\n<h3 id=\"h3-27\">\u521b\u5efa<\/h3>\n\n\n\n<ul><li>\u65b9\u6cd5\u4e00\uff1aset<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">set&nbsp;a[0]=1<\/pre>\n\n\n\n<ul><li>\u65b9\u6cd5\u4e8c\uff1a\u503c\u5217\u8868\u904d\u5386<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">@echo&nbsp;offset&nbsp;list=1&nbsp;2&nbsp;3&nbsp;4(for&nbsp;%%a&nbsp;in&nbsp;(%list%)&nbsp;do&nbsp;(&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;%%a))<\/pre>\n\n\n\n<h3 id=\"h3-28\">\u8bbf\u95ee<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">echo&nbsp;%a[0]%<\/pre>\n\n\n\n<h3 id=\"h3-29\">\u4fee\u6539<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">Set&nbsp;a[3]=4<\/pre>\n\n\n\n<h3 id=\"h3-30\">\u8fed\u4ee3<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">@echo&nbsp;offsetlocal enabledelayedexpansionset&nbsp;topic[0]=commentsset&nbsp;topic[1]=variablesset&nbsp;topic[2]=Arraysset&nbsp;topic[3]=Decision&nbsp;makingset&nbsp;topic[4]=Time&nbsp;and&nbsp;dateset&nbsp;topic[5]=Operators&nbsp;for&nbsp;\/l&nbsp;%%n&nbsp;in&nbsp;(0,1,5)&nbsp;do&nbsp;(&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;!topic[%%n]!)<\/pre>\n\n\n\n<p class=\"is-style-text-indent-default\">for\u5faa\u73af\u79fb\u52a8\u8303\u56f4\u7684<code>\/L<\/code>\u53c2\u6570\u7528\u4e8e<strong>\u8fed\u4ee3\u6570\u7ec4<\/strong>\u3002<\/p>\n\n\n\n<h3 id=\"h3-31\">\u6570\u7ec4\u957f\u5ea6<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">@echo&nbsp;offset&nbsp;Arr[0]=1set&nbsp;Arr[1]=2set&nbsp;Arr[2]=3set&nbsp;Arr[3]=4set&nbsp;\"x=0\":SymLoop&nbsp;if&nbsp;defined&nbsp;Arr[%x%]&nbsp;(&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;call echo&nbsp;%%Arr[%x%]%%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set&nbsp;\/a&nbsp;\"x+=1\"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GOTO&nbsp;:SymLoop)echo&nbsp;\"The length of the array is\"&nbsp;%x%<\/pre>\n\n\n\n<h3 id=\"h3-32\">\u7ed3\u6784\u4f53<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">@echo&nbsp;offset&nbsp;len=3set&nbsp;obj[0].Name=Joeset&nbsp;obj[0].ID=1set&nbsp;obj[1].Name=Markset&nbsp;obj[1].ID=2set&nbsp;obj[2].Name=Mohanset&nbsp;obj[2].ID=3set&nbsp;i=0:loopif&nbsp;%i%&nbsp;equ&nbsp;%len%&nbsp;goto&nbsp;:eofset&nbsp;cur.Name=set&nbsp;cur.ID=for&nbsp;\/f&nbsp;\"usebackq delims==.tokens=1-3\"&nbsp;%%j&nbsp;in&nbsp;(`set obj[%i%]`)&nbsp;do&nbsp;(&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set&nbsp;cur.%%k=%%l)echo&nbsp;Name=%cur.Name%echo&nbsp;Value=%cur.ID%set&nbsp;\/a i=%i%+1goto&nbsp;loop<\/pre>\n\n\n\n<h2 id=\"h2-33\">if\u8bed\u53e5<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">if&nbsp;%c%==15&nbsp;(echo&nbsp;\"The value of variable c is 15\")&nbsp;else&nbsp;(echo&nbsp;\"Unknown value\")<\/pre>\n\n\n\n<h3 id=\"h3-34\"><code>if defined<\/code>&nbsp;\uff1a\u53d8\u91cf\u662f\u5426\u5b58\u5728<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">if&nbsp;defined&nbsp;str1 echo&nbsp;\"Variable str1 is defined\"<\/pre>\n\n\n\n<h3 id=\"h3-35\"><code>if exists<\/code>\uff1a\u6587\u4ef6\u662f\u5426\u5b58\u5728<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">if&nbsp;exist C:\\set3.txt&nbsp;(echo&nbsp;\"File exists\")&nbsp;else&nbsp;(echo&nbsp;\"File does not exist\")<\/pre>\n\n\n\n<h3 id=\"h3-36\"><code>if errorlevel<\/code>\uff1a\u6d4b\u8bd5\u8fd0\u884c\u7684\u6700\u540e\u4e00\u4e2a\u547d\u4ee4\u7684\u9000\u51fa\u4ee3\u7801<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">if&nbsp;errorlevel n somecommand<\/pre>\n\n\n\n<p class=\"is-style-text-indent-default\">\u5404\u79cd\u547d\u4ee4\u53d1\u51fa\u6574\u6570\u9000\u51fa\u4ee3\u7801\u6765\u8868\u793a\u547d\u4ee4\u7684\u72b6\u6001\u3002 \u901a\u5e38\uff0c\u5982\u679c\u547d\u4ee4\u6210\u529f\u5b8c\u6210\uff0c\u5219\u547d\u4ee4\u901a\u8fc7\u4f20\u90120;\u5982\u679c\u547d\u4ee4\u5931\u8d25\uff0c\u547d\u4ee4\u901a\u8fc7\u4f20\u90121\u3002<\/p>\n\n\n\n<h2 id=\"h2-37\">for\u8bed\u53e5<\/h2>\n\n\n\n<ul><li>%variable \u6307\u5b9a\u4e00\u4e2a\u5355\u4e00\u5b57\u6bcd\u53ef\u66ff\u6362\u7684\u53c2\u6570\u3002\u6ce8\u610f\uff1a\u6279\u5904\u7406\u811a\u672c\u4e2d\u4f7f\u7528%%variable<\/li><li>(set) \u6307\u5b9a\u4e00\u4e2a\u6216\u4e00\u7ec4\u6587\u4ef6\u3002\u53ef\u4ee5\u4f7f\u7528\u901a\u914d\u7b26\u3002<\/li><li>command \u6307\u5b9a\u5bf9\u6bcf\u4e2a\u6587\u4ef6\u6267\u884c\u7684\u547d\u4ee4\u3002<\/li><li>command-parameters \u4e3a\u7279\u5b9a\u547d\u4ee4\u6307\u5b9a\u53c2\u6570\u6216\u547d\u4ee4\u884c\u5f00\u5173\u3002<\/li><\/ul>\n\n\n\n<h3 id=\"h3-38\">\/d<\/h3>\n\n\n\n<h3 id=\"h3-39\">\/r<\/h3>\n\n\n\n<h3 id=\"h3-40\">\/l<\/h3>\n\n\n\n<h3 id=\"h3-41\">\/f<\/h3>\n\n\n\n<h2 id=\"h2-42\">goto\u8bed\u53e5<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">@echo&nbsp;offSET&nbsp;\/A a=5&nbsp;if&nbsp;%a%==5 goto :labelaif&nbsp;%a%==10&nbsp;goto&nbsp;:labelb:labelaecho&nbsp;\"The value of a is 5\"exit&nbsp;\/b&nbsp;0:labelbecho&nbsp;\"The value of a is 10\"<\/pre>\n\n\n\n<h2 id=\"h2-43\">\u8fd0\u7b97\u7b26<\/h2>\n\n\n\n<h3 id=\"h3-44\">\u5173\u7cfb\u8fd0\u7b97\u7b26<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u8fd0\u7b97\u7b26<\/th><th>\u5907\u6ce8<\/th><\/tr><\/thead><tbody><tr><td>EQU<\/td><td>\u76f8\u7b49<\/td><\/tr><tr><td>NEQ<\/td><td>\u4e0d\u7b49<\/td><\/tr><tr><td>LSS<\/td><td>\u5de6\u5c0f\u4e8e\u53f3<\/td><\/tr><tr><td>LEQ<\/td><td>\u5c0f\u4e8e\u7b49\u4e8e<\/td><\/tr><tr><td>GTR<\/td><td>\u5927\u4e8e<\/td><\/tr><tr><td>GEQ<\/td><td>\u5927\u4e8e\u7b49\u4e8e<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 id=\"h2-45\">\u7cfb\u7edf\u65e5\u671f<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">echo&nbsp;%DATE%<\/pre>\n\n\n\n<h3 id=\"h3-46\">\u65e5\u671f\u683c\u5f0f\u5316<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">@echo&nbsp;offecho\/Today&nbsp;is:&nbsp;%year%-%month%-%day%goto&nbsp;:EOFsetlocal ENABLEEXTENSIONSset&nbsp;t=2&amp;if&nbsp;\"%date%z\"&nbsp;LSS&nbsp;\"A\"&nbsp;set&nbsp;t=1&nbsp;for&nbsp;\/f&nbsp;\"skip=1 tokens=2-4 delims=(-)\"&nbsp;%%a&nbsp;in&nbsp;('echo\/^|date')&nbsp;do&nbsp;(&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;\/f&nbsp;\"tokens=%t%-4 delims=.-\/ \"&nbsp;%%d&nbsp;in&nbsp;('date\/t')&nbsp;do&nbsp;(&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set&nbsp;%%a=%%d&amp;set&nbsp;%%b=%%e&amp;set&nbsp;%%c=%%f))endlocal&amp;set&nbsp;%1=%yy%&amp;set&nbsp;%2=%mm%&amp;set&nbsp;%3=%dd%&amp;goto&nbsp;:EOF<\/pre>\n\n\n\n<h2 id=\"h2-47\">\u7cfb\u7edf\u65f6\u95f4<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">echo&nbsp;%TIME%<\/pre>\n\n\n\n<h2 id=\"h2-48\">\u8f93\u5165\u8f93\u51fa<\/h2>\n\n\n\n<ul><li>0\uff1astdin \u6807\u51c6\u8f93\u5165<\/li><li>1\uff1astdout \u6807\u51c6\u8f93\u51fa<\/li><li>2\uff1astderr \u9519\u8bef\u6d88\u606f<\/li><\/ul>\n\n\n\n<h3 id=\"h3-49\">\u91cd\u5b9a\u5411<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">DIR C:\\&nbsp;&gt;&nbsp;lists.txt&nbsp;2&gt;&nbsp;&amp;1<\/pre>\n\n\n\n<ul><li>\u4f7f\u7528\u6587\u4ef6\u7f16\u53f7\u548c&#8221;&amp;&#8221;\u524d\u7f00\u6765\u7ec4\u5408stdout\u548cstderr\u6d41<\/li><\/ul>\n\n\n\n<h2 id=\"h2-50\">\u51fd\u6570<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">:function_nameDo_somethingEXIT&nbsp;\/B&nbsp;0<\/pre>\n\n\n\n<ul><li>function_name\u662f\u8d4b\u4e88\u51fd\u6570\u7684\u540d\u5b57\uff0c\u5b83\u5e94\u8be5\u4e0e\u51fd\u6570\u7684\u5b9e\u9645\u529f\u80fd\u76f8\u5339\u914d\u3002<\/li><li>EXIT\u8bed\u53e5\u7528\u4e8e\u786e\u4fdd\u51fd\u6570\u6b63\u5e38\u9000\u51fa.<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">:DisplaySET&nbsp;\/A index=2echo&nbsp;The&nbsp;value of index&nbsp;is&nbsp;%index%EXIT&nbsp;\/B&nbsp;0<\/pre>\n\n\n\n<h3 id=\"h3-51\">\u8c03\u7528 call :function_name<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">@echo&nbsp;offRem&nbsp;mainSETLOCALCALL&nbsp;:Display&nbsp;5&nbsp;,&nbsp;10EXIT&nbsp;\/B&nbsp;%ERRORLEVEL%Rem&nbsp;function:Displayecho&nbsp;The&nbsp;value of parameter&nbsp;1&nbsp;is&nbsp;%~1echo&nbsp;The&nbsp;value of parameter&nbsp;2&nbsp;is&nbsp;%~2EXIT&nbsp;\/B&nbsp;0<\/pre>\n\n\n\n<ul><li>\u786e\u4fdd\u5728\u4e3b\u7a0b\u5e8f\u4e2d\u653e\u5165<code>EXIT \/ B%ERRORLEVEL%<\/code>\u8bed\u53e5\uff0c\u4ee5\u4fbf\u5c06\u4e3b\u7a0b\u5e8f\u7684\u4ee3\u7801\u4e0e\u51fd\u6570\u5206\u5f00\u3002<\/li><li>\u4f7f\u7528<code>~1<\/code>\u6765\u8bbf\u95ee\u53d1\u9001\u7ed9\u51fd\u6570\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\uff0c\u540c\u6837\u4f7f\u7528<code>~2<\/code>\u6765\u8bbf\u95ee\u7b2c\u4e8c\u4e2a\u53c2\u6570\u3002<\/li><\/ul>\n\n\n\n<h2 id=\"h2-52\">\u8fdb\u7a0b<\/h2>\n\n\n\n<h3 id=\"h3-53\">\u67e5\u770b\u8fdb\u7a0b\u5217\u8868TASKLIST<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">::&nbsp;\u83b7\u53d6\u5185\u5b58\u5927\u4e8e40MB\u7684\u8fdb\u7a0btasklist&nbsp;\/fi&nbsp;\"memusage gt 40000\"<\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>&nbsp;<\/th><th>&nbsp;<\/th><\/tr><\/thead><tbody><tr><td>\/S system<\/td><td>\u6307\u5b9a\u8981\u8fde\u63a5\u7684\u8fdc\u7a0b\u7cfb\u7edf<\/td><\/tr><tr><td>\/U [domain]user<\/td><td>\u6307\u5b9a\u547d\u4ee4\u5e94\u5728\u5176\u4e0b\u6267\u884c\u7684\u7528\u6237\u4e0a\u4e0b\u6587<\/td><\/tr><tr><td>\/P [password]<\/td><td>\u6307\u5b9a\u7ed9\u5b9a\u7528\u6237\u4e0a\u4e0b\u6587\u7684\u5bc6\u7801\u3002 \u63d0\u793a\u8f93\u5165\uff0c\u5982\u679c\u7701\u7565\u3002<\/td><\/tr><tr><td>\/M [module]<\/td><td>\u5217\u51fa\u5f53\u524d\u4f7f\u7528\u7ed9\u5b9a\u7684exe \/ dll\u540d\u79f0\u7684\u6240\u6709\u4efb\u52a1\u3002 \u5982\u679c\u672a\u6307\u5b9a\u6a21\u5757\u540d\u79f0\uff0c\u5219\u663e\u793a\u6240\u6709\u5df2\u52a0\u8f7d\u7684\u6a21\u5757\u3002<\/td><\/tr><tr><td>\/SVC<\/td><td>\u663e\u793a\u6bcf\u4e2a\u8fdb\u7a0b\u4e2d\u6258\u7ba1\u7684\u670d\u52a1\u3002<\/td><\/tr><tr><td>\/V<\/td><td>\u663e\u793a\u8be6\u7ec6\u7684\u4efb\u52a1\u4fe1\u606f\u3002<\/td><\/tr><tr><td>\/FI filter<\/td><td>\u663e\u793a\u4e00\u7ec4\u7b26\u5408\u8fc7\u6ee4\u5668\u6307\u5b9a\u6761\u4ef6\u7684\u4efb\u52a1\u3002<\/td><\/tr><tr><td>\/FO format<\/td><td>\u6307\u5b9a\u8f93\u51fa\u683c\u5f0f\u3002 \u6709\u6548\u503c:TABLE\uff0cLIST\uff0cCSV\u3002<\/td><\/tr><tr><td>\/NH<\/td><td>\u6307\u5b9a\u201c\u5217\u6807\u9898\u201d\u4e0d\u5e94\u663e\u793a\u5728\u8f93\u51fa\u4e2d\u3002 \u4ec5\u9002\u7528\u4e8eTABLE\u548cCSV\u683c\u5f0f\u3002<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<pre class=\"wp-block-preformatted\">::&nbsp;\u83b7\u53d6\u5185\u5b58\u5927\u4e8e40MB\u7684\u8fdb\u7a0btasklist&nbsp;\/fi&nbsp;\"memusage gt 40000\"<\/pre>\n\n\n\n<h3 id=\"h3-54\">\u7ec8\u6b62\u8fdb\u7a0b<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">START&nbsp;\"title\"&nbsp;[\/D path]&nbsp;[options]&nbsp;\"command\"&nbsp;[parameters]<\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>&nbsp;<\/th><th>&nbsp;<\/th><\/tr><\/thead><tbody><tr><td>\/S system<\/td><td>\u6307\u5b9a\u8981\u8fde\u63a5\u7684\u8fdc\u7a0b\u7cfb\u7edf<\/td><\/tr><tr><td>\/U [domain]user<\/td><td>\u6307\u5b9a\u547d\u4ee4\u5e94\u5728\u5176\u4e0b\u6267\u884c\u7684\u7528\u6237\u4e0a\u4e0b\u6587\u3002<\/td><\/tr><tr><td>\/P [password]<\/td><td>\u6307\u5b9a\u7ed9\u5b9a\u7528\u6237\u4e0a\u4e0b\u6587\u7684\u5bc6\u7801\u3002 \u63d0\u793a\u8f93\u5165\uff0c\u5982\u679c\u7701\u7565\u3002<\/td><\/tr><tr><td>\/FI FilterName<\/td><td>\u5e94\u7528\u8fc7\u6ee4\u5668\u6765\u9009\u62e9\u4e00\u7ec4\u4efb\u52a1\uff0c\u5141\u8bb8\u4f7f\u7528*\u901a\u914d\u7b26\u3002<\/td><\/tr><tr><td>\/PID processID<\/td><td>\u6307\u5b9a\u8981\u7ec8\u6b62\u7684\u8fdb\u7a0b\u7684PID\u3002\u4f7f\u7528TaskList\u6765\u83b7\u53d6PID\u3002<\/td><\/tr><tr><td>\/IM ImageName<\/td><td>\u6307\u5b9a\u8981\u7ec8\u6b62\u7684\u8fdb\u7a0b\u7684\u6620\u50cf\u540d\u79f0\u3002 \u901a\u914d\u7b26*\u53ef\u7528\u4e8e\u6307\u5b9a\u6240\u6709\u4efb\u52a1\u6216\u56fe\u50cf\u540d\u79f0\u3002<\/td><\/tr><tr><td>\/T<\/td><td>\u7ec8\u6b62\u6307\u5b9a\u7684\u8fdb\u7a0b\u4ee5\u53ca\u7531\u5176\u542f\u52a8\u7684\u4efb\u4f55\u5b50\u8fdb\u7a0b\u3002<\/td><\/tr><tr><td>\/F<\/td><td>\u6307\u5b9a\u5f3a\u5236\u7ec8\u6b62\u8fdb\u7a0b\u3002<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<pre class=\"wp-block-preformatted\">::&nbsp;\u6740\u6b7b(\u7ec8\u6b62)\u6253\u5f00\u7684\u8bb0\u4e8b\u672c\u4efb\u52a1taskkill&nbsp;\/f&nbsp;\/im notepad.exe::&nbsp;\u6740\u6b7b\u4e86\u4e00\u4e2aID\u4e3a9901\u7684\u8fdb\u7a0btaskill&nbsp;\/pid&nbsp;9901<\/pre>\n\n\n\n<h3 id=\"h3-55\">\u542f\u52a8\u8fdb\u7a0b<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">START&nbsp;\"title\"&nbsp;[\/D path]&nbsp;[options]&nbsp;\"command\"&nbsp;[parameters]<\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>&nbsp;<\/th><th>&nbsp;<\/th><\/tr><\/thead><tbody><tr><td>title<\/td><td>CMD\u7a97\u53e3\u6807\u9898\u680f\u7684\u6587\u672c(\u5fc5\u9700)<\/td><\/tr><tr><td>path<\/td><td>\u8d77\u59cb\u76ee\u5f55\u3002<\/td><\/tr><tr><td>command<\/td><td>\u547d\u4ee4\uff0c\u6279\u5904\u7406\u6587\u4ef6\u6216\u53ef\u6267\u884c\u7a0b\u5e8f\u8fd0\u884c\u3002<\/td><\/tr><tr><td>parameters<\/td><td>\u4f20\u9012\u7ed9\u547d\u4ee4\u7684\u53c2\u6570<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"is-style-text-indent-default\">options:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>&nbsp;<\/th><th>&nbsp;<\/th><\/tr><\/thead><tbody><tr><td>\/MIN<\/td><td>\u542f\u52a8\u7a97\u53e3\u6700\u5c0f\u5316\u3002<\/td><\/tr><tr><td>\/MAX<\/td><td>\u542f\u52a8\u7a97\u53e3\u6700\u5927\u5316\u3002<\/td><\/tr><tr><td>\/LOW<\/td><td>\u4f7f\u7528IDLE\u4f18\u5148\u7ea7\u3002<\/td><\/tr><tr><td>\/NORMAL<\/td><td>\u4f7f\u7528NORMAL\u4f18\u5148\u7ea7\u3002<\/td><\/tr><tr><td>\/ABOVENORMAL<\/td><td>\u4f7f\u7528ABOVENORMAL\u4f18\u5148\u7ea7\u3002<\/td><\/tr><tr><td>\/BELOWNORMAL<\/td><td>\u4f7f\u7528BELOWNORMAL\u4f18\u5148\u7ea7\u3002<\/td><\/tr><tr><td>\/HIGH<\/td><td>\u4f7f\u7528HIGH\u4f18\u5148\u7ea7\u3002<\/td><\/tr><tr><td>\/REALTIME<\/td><td>\u4f7f\u7528REALTIME\u4f18\u5148\u7ea7\u3002<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<pre class=\"wp-block-preformatted\">::&nbsp;\u5728\u65b0\u7a97\u53e3\u4e2d\u8fd0\u884c\u6279\u5904\u7406\u811a\u672ctest.bat\u3002&nbsp;\u7a97\u53e3\u5c06\u4ee5\u6700\u5c0f\u5316\u6a21\u5f0f\u542f\u52a8\uff0c\u5e76\u4e14\u6307\u5b9a\u6807\u9898\u4e3a:\u201cTest&nbsp;Batch&nbsp;Script\u201d\u3002START&nbsp;\"Test Batch Script\"&nbsp;\/Min&nbsp;test.bat::&nbsp;\u5728\u53e6\u4e00\u4e2a\u8fdb\u7a0b\u4e2d\u8fd0\u884cMicrosoft&nbsp;Word\uff0c\u7136\u540e\u5728MS&nbsp;Word\u4e2d\u6253\u5f00\u6587\u4ef6TESTA.txtSTART&nbsp;\"\"&nbsp;\"C:\\Program Files\\Microsoft Office\\Winword.exe\"&nbsp;\"D:\\test\\TESTA.txt\"<\/pre>\n\n\n\n<h2 id=\"h2-56\">\u522b\u540d<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">dw=dir&nbsp;\/w<\/pre>\n\n\n\n<p class=\"is-style-text-indent-default\">\u5f53\u8981\u6267\u884cdir \/w\u547d\u4ee4\u65f6\uff0c\u53ef\u4ee5\u7b80\u5355\u5730\u952e\u5165dw\u8fd9\u4e2a\u5355\u8bcd\u3002dw\u8fd9\u4e2a\u8bcd\u73b0\u5728\u5df2\u7ecf\u6210\u4e3a\u547d\u4ee4dir \/w\u7684\u522b\u540d\u3002<\/p>\n\n\n\n<h3 id=\"h3-57\">doskey \u522b\u540d\u7ba1\u7406<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">DOSKEY&nbsp;[options]&nbsp;[macroname=[text]]<\/pre>\n\n\n\n<h4>\u521b\u5efa<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">@echo&nbsp;offdoskey cd=cd\/testdoskey d=dir<\/pre>\n\n\n\n<h4>\u5220\u9664<\/h4>\n\n\n\n<pre class=\"wp-block-preformatted\">@echo&nbsp;offdoskey cd=cd\/testdoskey d=dird=<\/pre>\n\n\n\n<p class=\"is-style-text-indent-default\">\u5c06d\u7684\u503c\u8bbe\u7f6e\u4e3aNULL\uff0c\u6240\u4ee5\u5b8fd\u5c06\u88ab\u5220\u9664\u3002<\/p>\n\n\n\n<h2 id=\"h2-58\">\u7ba1\u9053\uff08<code>|<\/code>\uff09<\/h2>\n\n\n\n<p class=\"is-style-text-indent-default\">\u7ba1\u9053\u8fd0\u7b97\u7b26(|)\u5c06\u4e00\u4e2a\u547d\u4ee4\u7684\u8f93\u51fa(\u9ed8\u8ba4\u4e3aSTDOUT)\u5f15\u5bfc\u5230\u53e6\u4e00\u4e2a\u547d\u4ee4\u7684\u8f93\u5165(\u9ed8\u8ba4\u4e3aSTDIN)\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">::&nbsp;\u4e24\u4e2a\u547d\u4ee4\u540c\u65f6\u542f\u52a8\uff0c\u4f46\u662fsort\u547d\u4ee4\u6682\u505c\uff0c\u76f4\u5230\u5b83\u63a5\u6536\u5230dir\u547d\u4ee4\u7684\u8f93\u51fa\u3002::&nbsp;sort\u547d\u4ee4\u4f7f\u7528dir\u547d\u4ee4\u7684\u8f93\u51fa\u4f5c\u4e3a\u8f93\u5165\uff0c\u7136\u540e\u5c06\u5176\u8f93\u51fa\u53d1\u9001\u5230\u53e5\u67c41(\u5373STDOUT)\u3002dir C:\\&nbsp;|&nbsp;sort<\/pre>\n\n\n\n<p class=\"is-style-text-indent-default\">\u5230\u6b64\u8fd9\u7bc7\u5173\u4e8e\u6559\u4f60\u7f16\u5199bat\u811a\u672cWindows\u6279\u5904\u7406\u7684\u6587\u7ae0\u5c31\u4ecb\u7ecd\u5230\u8fd9\u4e86,\u66f4\u591a\u76f8\u5173bat\u811a\u672cWindows\u6279\u5904\u7406\u5185\u5bb9\u8bf7\u641c\u7d22\u6211\u4eec\u4ee5\u524d\u7684\u6587\u7ae0\u6216\u7ee7\u7eed\u6d4f\u89c8\u4e0b\u9762\u7684\u76f8\u5173\u6587\u7ae0\u5e0c\u671b\u5927\u5bb6\u4ee5\u540e\u591a\u591a\u652f\u6301\u6211\u4eec\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u76ee\u5f55\u5e38\u89c1\u7528\u9014bat\u547d\u4ee4\u901f\u67e5\u5e38\u7528\u53c2\u6570echo\u6ce8\u91caRem\u4f7f\u7528::\u58f0\u660edir\uff1a\u83b7\u53d6\u76ee\u5f55\u5185\u5bb9\uff1a\u5c06\u8f93\u51fa\u91cd\u5b9a\u5411\u5230\u6587\u4ef6\u53d8\u91cf\u547d [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[11],"tags":[35,34],"_links":{"self":[{"href":"https:\/\/www.01j.top\/index.php?rest_route=\/wp\/v2\/posts\/207"}],"collection":[{"href":"https:\/\/www.01j.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.01j.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.01j.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.01j.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=207"}],"version-history":[{"count":1,"href":"https:\/\/www.01j.top\/index.php?rest_route=\/wp\/v2\/posts\/207\/revisions"}],"predecessor-version":[{"id":208,"href":"https:\/\/www.01j.top\/index.php?rest_route=\/wp\/v2\/posts\/207\/revisions\/208"}],"wp:attachment":[{"href":"https:\/\/www.01j.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=207"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.01j.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=207"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.01j.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=207"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}