{"id":88,"date":"2018-01-18T11:11:55","date_gmt":"2018-01-18T03:11:55","guid":{"rendered":"http:\/\/blog.coolcoding.cn\/blog\/?p=88"},"modified":"2020-09-27T17:04:50","modified_gmt":"2020-09-27T09:04:50","slug":"bat-command-use-array","status":"publish","type":"post","link":"https:\/\/blog.coolcoding.cn\/?p=88","title":{"rendered":"windows bat syntax"},"content":{"rendered":"<h1>1.\u4f7f\u7528\u6570\u7ec4<\/h1>\n<p>set s[0]=1<br>set s[1]=2<br>for \/F &#8220;tokens=2 delims==&#8221; %%s in (&#8216;set s[&#8216;) do (<br>echo %%s<br>)<\/p>\n<h1>2.\u8bbe\u7f6e\u5de5\u4f5c\u8def\u5f84<\/h1>\n<p>pushd &#8220;%~dp0&#8221;<\/p>\n<p>&#8230;<\/p>\n<p>popd<\/p>\n<h1>3.\u8f93\u5165\u5b57\u7b26\u6d41<\/h1>\n<p>echo y|pscp &#8230;<\/p>\n<h1>4.\u4e0d\u8981\u663e\u793a\u8f93\u51fa<\/h1>\n<p>&#8230; &gt; nul<\/p>\n<h1>5.\u5ef6\u65f6<\/h1>\n<p>ping 127.0.0.1 -n 2 &gt; nul<\/p>\n<h1>6.\u8c03\u7528\u53e6\u4e00\u4e2abat<\/h1>\n<p>call &#8220;..\/xxx.bat&#8221;<\/p>\n<h1>7.\u968f\u673a\u6570<\/h1>\n<p>set a=%random%<\/p>\n<h1>8.\u8f93\u5165\u53c2\u6570<\/h1>\n<p>set a=%1<\/p>\n<p>set b=%2<\/p>\n<p>\u4ece%1 \u5f00\u59cb<\/p>\n<h1>9.\u5168\u90e8\u53c2\u6570\u4f20\u9012<\/h1>\n<p>call.exe %*<\/p>\n<p>\u5373\u5411call.exe\u4f20\u5165\u6b64BAT\u83b7\u5f97\u7684\u6240\u6709\u8f93\u5165\u53c2\u6570<\/p>\n\n\n<h2 class=\"wp-block-heading\">10.\u53c2\u6570\u79fb\u4f4d<\/h2>\n\n\n\n<p>\u82e5\u8f93\u5165\u53c2\u6570\u67093\u4e2a<br>%1\u4e3a\u7b2c1\u4e2a\u53c2\u6570<br>@shift<br>%1\u5219\u4e3a\u7b2c2\u4e2a\u53c2\u6570<br>@shift<br>%1\u5219<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1.\u4f7f\u7528\u6570\u7ec4 set s[0]=1set s[1]=2for \/F &#8220;tokens=2 delim [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"chat","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/88"}],"collection":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=88"}],"version-history":[{"count":7,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/88\/revisions"}],"predecessor-version":[{"id":2671,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/88\/revisions\/2671"}],"wp:attachment":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=88"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=88"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=88"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}