{"id":1167,"date":"2013-06-10T16:31:12","date_gmt":"2013-06-10T08:31:12","guid":{"rendered":"http:\/\/blog.hoyo.idv.tw\/?p=1167"},"modified":"2023-04-22T08:51:53","modified_gmt":"2023-04-22T00:51:53","slug":"windows-%e6%af%8f%e6%97%a5%e8%a4%87%e8%a3%bd%e6%aa%94%e6%a1%88%e5%88%b0%e5%82%99%e4%bb%bd%e4%b8%bb%e6%a9%9f","status":"publish","type":"post","link":"https:\/\/blog.hoyo.idv.tw\/?p=1167","title":{"rendered":"\u5f9e windows \u4e0a\u9032\u884c\u6bcf\u65e5\u7570\u52d5\u6a94\u6848\u5099\u4efd"},"content":{"rendered":"<h2 class=\"brush: dosbatch; gutter: true\">Windows Command \u5931\u6557\u7684\u6848\u4f8b<\/h2>\n<p class=\"brush: dosbatch; gutter: true\">\u6709\u4e00\u53f0\u63d0\u4f9b\u5099\u4efd\u7684 Windows \u4e3b\u6a5f\uff0c\u4e3b\u8981\u63d0\u4f9b\u7684\u5de5\u4f5c\u8a2d\u60f3\u70ba\uff1a\u6839\u64da\u5099\u4efd\u5c0d\u8c61\u7576\u5929\u7570\u52d5\u7684\u6240\u6709\u6a94\u6848\u9032\u884c\u8907\u88fd<\/p>\n<ol>\n<li>\u5728\u5099\u4efd\u8cc7\u6599\u593e\u65b0\u589e\u7576\u5929\u65e5\u671f\u8cc7\u6599\u593e<\/li>\n<li>\u641c\u5c0b\u5099\u4efd\u5c0d\u8c61\u6240\u6709\u7576\u5929\u7570\u52d5\u6a94\u6848\uff0c\u4e26\u8907\u88fd\u5230\u7576\u5929\u8cc7\u6599\u593e\u5167<\/li>\n<\/ol>\n<div>\u4e00\u958b\u59cb\u53ea\u6253\u7b97\u4f7f\u7528 DOS Command \u4e5f\u5c31\u662f\u6700\u57fa\u790e\u7684\u6307\u4ee4\u8a2d\u8a08\uff0c\u6478\u7d22\u4e86\u4e00\u4e0b\uff0c\u5beb\u4e86\u4e0b\u9762\u9019\u500b\u6279\u6b21\u6a94\uff1a<\/div>\n<pre class=\"brush: dosbatch; gutter: true\">@Echo On\r\nSET _date=%date:~0,4%-%date:~5,2%-%date:~8,2%\r\nSET _xcopydate=%date:~5,2%-%date:~8,2%-%date:~0,4%\r\nMKDIR C:\\BACKUP\\%_date%\r\nCD C:\\BACKUP\\%_date%\r\nXCOPY C:\\TEST \/E\/C\/H\/Y\/D:%_xcopydate%\r\nPAUSE<\/pre>\n<p class=\"brush: dosbatch; gutter: true\">\u6c7a\u5b9a\u4f7f\u7528 windows batch file \u662f\u932f\u8aa4\u7684\u6c7a\u5b9a\uff0c\u56e0\u70ba\u4f86\u6e90\u6a94\u6848\u6709\u91cd\u8907\u6a94\u540d\uff0c\u56e0\u6b64\u9700\u8981\u52a0\u4e0a\u4e00\u500b\u6d41\u6c34\u78bc\u907f\u514d\u8986\u84cb\u3002\u5982\u679c\u4f7f\u7528 xcopy \u6307\u4ee4\u641c\u5c0b\u7b26\u5408\u65e5\u671f\u6a94\u6848\u8907\u88fd\uff0c\u90a3\u5c31\u7121\u6cd5\u9032\u884c\u6a94\u540d\u7684\u8b8a\u66f4\uff0c\u6700\u5f8c\u6211\u53c8\u4f7f\u7528 PHP \u8655\u7406\u3002<\/p>\n<h2 class=\"brush: dosbatch; gutter: true\">PHP \u7a0b\u5f0f\u904b\u4f5c\u6d41\u7a0b<\/h2>\n<ol>\n<li>\u4f7f\u7528\u7cfb\u7d71\u6307\u4ee4 DIR \u7522\u751f\u6240\u6709\u6a94\u6848\u5217\u8868\uff0c\u5efa\u7acb\u6210\u6587\u5b57\u6a94<\/li>\n<li>\u5efa\u7acb\u7576\u65e5\u5099\u4efd\u65e5\u671f\u76ee\u9304<\/li>\n<li>\u89e3\u6790 DIR \u6587\u5b57\u6a94\u5167\u5bb9\uff0c\u641c\u5c0b\u7b26\u5408\u65e5\u671f\u6a94\u6848<\/li>\n<li>\u5c07\u7b26\u5408\u6a94\u6848\u52a0\u4e0a\u6d41\u6c34\u78bc\u8907\u88fd\u5230\u65e5\u671f\u76ee\u9304\u4e2d<\/li>\n<\/ol>\n<div><strong>1<\/strong>. \u7522\u751f\u6240\u6709\u5217\u8868\u6a94\u6848\u4ee5\u53ca\u751f\u6210\u6587\u5b57\u6a94<\/div>\n<div>\n<pre class=\"brush: dosbatch; gutter: true\">DIR \/S\/A &gt; E:\\DIR.TXT<\/pre>\n<p class=\"brush: dosbatch; gutter: true\"><strong>2<\/strong>.\u00a0\u5efa\u7acb\u7576\u65e5\u5099\u4efd\u65e5\u671f\u76ee\u9304<\/p>\n<pre class=\"brush: php; gutter: true\">&lt;?php\r\n    $now_day = date( &quot;Ymd&quot; );\r\n    exec( &#039;mkdir e:\\\\&#039;. $now_day );\r\n?&gt;<\/pre>\n<p class=\"brush: actionscript3; gutter: true\"><strong>3<\/strong>. \u89e3\u6790\u6587\u5b57\u6a94\u6848\uff0c\u627e\u5230\u7b26\u5408\u689d\u4ef6\u6a94\u6848<\/p>\n<p class=\"brush: actionscript3; gutter: true\">\u7522\u751f\u7684\u6a94\u6848\u5217\u8868\u683c\u5f0f\u5927\u81f4\u5c31\u50cf\u4e0b\u9762\u9019\u6a23\uff0c\u4e0d\u540c\u7cfb\u7d71\uff0c\u4e0d\u540c\u6307\u4ee4\u53c3\u6578\u6703\u5f97\u5230\u4e0d\u540c\u7684\u683c\u5f0f\u3002\u5927\u81f4\u4e0a\u9700\u8981\u8655\u7406\u7684\u5c31\u662f<\/p>\n<ol>\n<li>\u4ee5 z: \u70ba\u5224\u8b80\u7684\u300c\u76ee\u9304\u300d\u8def\u5f91<\/li>\n<li>\u4ee5\u65e5\u671f\u683c\u5f0f\u958b\u982d\u7684\u6a94\u6848\u540d\u7a31<\/li>\n<li>\u4ee5\u53ca<strong>\u6392\u9664<\/strong>\u540c\u6a23\u662f\u65e5\u671f\u540d\u7a31\u958b\u982d\uff0c\u4f46\u662f\u6a94\u540d\u958b\u982d\u70ba\u300c\u00a0<strong>. \u00a0<\/strong>\u300d\u00a0\u7684\u76ee\u9304\u6558\u8ff0<\/li>\n<\/ol>\n<\/div>\n<pre> Z:\\2013-01-\u5c0f\u9ad8\u4e00xxx\\yyy\\2 \u5b8c\u6210\u6a941080\\2 \u5143\u4ef6\u5f0f\u5206\u985e\\01 zzz-\u5be6\u9a57\u5ba4\u8207\u57fa\u672c\u6e2c\u91cf \u7684\u76ee\u9304\r\n\r\n2013\/06\/03 \u4e0b\u5348 05:10 &lt;DIR&gt; .\r\n2013\/06\/03 \u4e0b\u5348 05:10 &lt;DIR&gt; ..\r\n2013\/05\/21 \u4e0b\u5348 01:42 838,210,111 01-1\u5be6\u9a57\u5ba4\u8207\u57fa\u672c\u6e2c\u91cf.mp4\r\n2013\/05\/21 \u4e0b\u5348 01:42 131,649,563 01-2\u4f8b\u984c01.mp4\r\n2013\/05\/21 \u4e0b\u5348 01:42 308,056,095 01-3\u4f8b\u984c02.03.mp4\r\n2013\/05\/21 \u4e0b\u5348 01:42 270,438,148 01-4\u4f8b\u984c05.mp4\r\n2013\/05\/21 \u4e0b\u5348 01:14 16,384 Thumbs.db\r\n             5 \u500b\u6a94\u6848 1,548,370,301 \u4f4d\u5143\u7d44\r\n\r\n Z:\\2013-01-\u5c0f\u9ad8\u4e00xxx\\yyy\\2 \u5b8c\u6210\u6a941080\\2 \u5143\u4ef6\u5f0f\u5206\u985e\\02 zzz-\u7269\u8cea\u3001\u6c34\u8207\u7a7a\u6c23 \u7684\u76ee\u9304\r\n\r\n2013\/06\/03 \u4e0b\u5348 05:11 &lt;DIR&gt; .\r\n2013\/06\/03 \u4e0b\u5348 05:11 &lt;DIR&gt; ..\r\n2013\/05\/21 \u4e0b\u5348 01:58 158,026,782 02-10\u7bc4\u4f8b09.mp4\r\n2013\/05\/21 \u4e0b\u5348 01:58 921,115,772 02-1\u7269\u8cea\u3001\u6c34\u8207\u7a7a\u6c23.mp4\r\n2013\/05\/21 \u4e0b\u5348 01:58 75,175,065 02-2\u7bc4\u4f8b01.mp4\r\n2013\/05\/21 \u4e0b\u5348 01:58 243,817,570 02-3\u7bc4\u4f8b02.mp4\r\n2013\/05\/21 \u4e0b\u5348 01:58 101,381,077 02-4\u7bc4\u4f8b03.mp4\r\n2013\/05\/21 \u4e0b\u5348 01:58 93,466,869 02-5\u7bc4\u4f8b04.mp4\r\n2013\/05\/21 \u4e0b\u5348 01:58 234,268,526 02-6\u7bc4\u4f8b05.mp4\r\n2013\/05\/21 \u4e0b\u5348 01:58 263,017,288 02-7\u7bc4\u4f8b06.mp4\r\n2013\/05\/21 \u4e0b\u5348 01:58 300,708,589 02-8\u7bc4\u4f8b07.mp4\r\n2013\/05\/21 \u4e0b\u5348 01:58 188,152,600 02-9\u7bc4\u4f8b08.mp4\r\n2013\/05\/21 \u4e0b\u5348 01:29 12,800 Thumbs.db\r\n            11 \u500b\u6a94\u6848 2,579,142,938 \u4f4d\u5143\u7d44<\/pre>\n<p>\u25bc \u4e0b\u9762\u9019\u5f35\u5716\u5c0d\u65bc\u683c\u5f0f\u7684\u6558\u8ff0\u6703\u6bd4\u8f03\u6e05\u695a<a href=\"http:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2013\/06\/\u5716\u7247-051.png\" data-rel=\"lightbox-image-0\" data-rl_title=\"\" data-rl_caption=\"\"><br \/>\n<img loading=\"lazy\" title=\"\" src=\"http:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2013\/06\/\u5716\u7247-051.png\" alt=\"\" width=\"722\" height=\"523\" \/><\/a><\/p>\n<pre class=\"brush: php; gutter: true\">&lt;?php\r\n    exec( &#039;mkdir e:\\\\&#039;. $now_day );\r\n    exec( &#039;dir z:\/s\/a &gt; e:\\dir.txt&#039; );\r\n    $openfile = fopen( &#039;e:\\dir.txt&#039;, &quot;r&quot; );\r\n    $file_count = 1;\r\n    unset( $path );\r\n    while (($str = fgets($openfile, 4096)) !== false) {\r\n        # [0] : \u7b2c\u4e00\u500b\u5b57\r\n        # [41] . \u81ea\u5df1 &amp; \u4e0a\u4e00\u5c64\r\n        if ( $str[41] == &#039;.&#039; || $str == &#039;&#039; ) continue; \/\/ \u5982\u679c\u662f\u7a7a\u767d\u6216\u662f\u6c92\u71df\u990a\u7684 . \uff0c\u6240\u4ee5\u53ef\u4ee5 PASS \u4e86\r\n        # \u8def\u5f91\u540d\u7a31\r\n        if ( $str[1].$str[2] == &#039;Z:&#039; ) $path = substr( $str, 1, -9 );\r\n        if ( $str[0].$str[1].$str[2].$str[3].$str[5].$str[6].$str[8].$str[9] == $now_day ) {\r\n            $file_name = substr( $str, 41 );\r\n            $file_name = substr( $file_name, 0, -2 );\r\n            $source = &#039;&quot;&#039;. $path .&#039;\\\\&#039;. $file_name .&#039;&quot;&#039;; \/\/ \u4f86\u6e90\r\n            $target = &#039;&quot;e:\\\\&#039;. $now_day .&#039;\\\\&#039;. $file_count .&#039;_&#039;. $file_name .&#039;&quot;&#039;; \/\/ \u76ee\u6a19\r\n\r\n            exec( &quot;copy $source $target &quot; );\r\n        }\r\n    $file_count++;\r\n}\r\n?&gt;<\/pre>\n<p class=\"brush: php; gutter: true\">\u7a0b\u5f0f\u6280\u5de7<\/p>\n<div>\n<ul>\n<li><a href=\"http:\/\/www.php.net\/manual\/en\/function.exec.php\" target=\"_blank\" rel=\"noopener\">exec()<\/a>\u00a0\u57f7\u884c\u7cfb\u7d71\u6307\u4ee4\uff0c\u9019\u88e1\u4f7f\u7528\u5728\n<ul>\n<li>\u5efa\u7acb\u8cc7\u6599\u593e mkdir<\/li>\n<li>\u986f\u793a\u6a94\u6848\u6e05\u55ae dir<\/li>\n<\/ul>\n<\/li>\n<li>dir \u6307\u4ee4\u5167\u7684\u5927\u65bc\u7b26\u865f <strong>&gt;<\/strong> \u529f\u80fd\u662f\u8f49\u5411\uff0c\u5728\u6b64\u7684\u4f5c\u7528\u662f\u5c07\u756b\u9762\u8f38\u51fa\u5230\u6a94\u6848\uff0c\u56e0\u6b64\u53f3\u908a\u5c31\u662f\u6a94\u6848\u540d\u7a31<\/li>\n<li><a href=\"http:\/\/www.php.net\/manual\/en\/function.exec.php\" target=\"_blank\" rel=\"noopener\">fgets()<\/a> \u4e00\u884c\u4e00\u884c\u7684\u8b80\u53d6\u6587\u5b57\u6a94\u6848\uff0c\u65b9\u4fbf\u5f8c\u7e8c\u8cc7\u6599\u5206\u6790<\/li>\n<li><a href=\"http:\/\/www.php.net\/manual\/en\/function.substr.php\" target=\"_blank\" rel=\"noopener\">substr()<\/a> \u8ca0\u8cac\u53d6\u51fa\u8def\u5f91\u53ca\u6a94\u6848\u540d\u7a31\uff0c\u4f7f\u7528\u8ca0\u503c\u662f\u5012\u6578 (\u5f9e\u53f3\u6578\u5230\u5de6) \u7684\u5b57\u4e0d\u53d6\uff0c-2 \u662f\u904e\u6ffe\u63db\u884c \\r\\n<\/li>\n<li>\u9810\u8a2d DOS \u63d0\u793a\u5b57\u5143\u8996\u7a97\u5b57\u78bc\u662f BIG5\uff0c\u6240\u4ee5\u4e00\u500b\u4e2d\u6587\u5b57\u8981\u7b97 2 \u500b\u5b57\u6578<\/li>\n<\/ul>\n<\/div>\n<p>\u25bc\u5b8c\u6210\u5f8c\u5c31\u50cf\u9019\u6a23\u5b50<br \/>\n<a href=\"http:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2013\/06\/\u5716\u7247-053.png\" data-rel=\"lightbox-image-1\" data-rl_title=\"\" data-rl_caption=\"\"><img loading=\"lazy\" title=\"\" src=\"http:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2013\/06\/\u5716\u7247-053.png\" alt=\"\" width=\"600\" height=\"424\" \/><\/a><\/p>\n<h2>\u5f85\u52a0\u5f37\u3001\u958b\u767c<\/h2>\n<ul>\n<li>\u53d6\u7528\u6a94\u6848\u4f7f\u7528 WEB \u4ecb\u9762 \u2192 \u00a0\u5b89\u88dd Apache<\/li>\n<li>\u5c07\u8907\u88fd\u4f86\u6e90\u53ca\u5099\u4efd\u6a94\u6848\u95dc\u806f\u7d00\u9304\uff0c\u65b9\u4fbf\u53d6\u7528\u6642\u78ba\u5b9a\u5c0d\u8c61\u53ca\u641c\u5c0b \u2192 \u5b89\u88dd MariaDB\uff0c<\/li>\n<li>\u91dd\u5c0d\u4ee5\u4e0a\u9700\u6c42\u958b\u767c\u7db2\u9801\u7a0b\u5f0f<\/li>\n<\/ul>\n<div class=\"pvc_clear\"><\/div>\n<p class=\"pvc_stats all \" data-element-id=\"1167\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> &nbsp;6,618&nbsp;total views<\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Windows Command...<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p class=\"pvc_stats all \" data-element-id=\"1167\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> &nbsp;6,618&nbsp;total views<\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[263,337],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/1167"}],"collection":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1167"}],"version-history":[{"count":22,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/1167\/revisions"}],"predecessor-version":[{"id":12125,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/1167\/revisions\/12125"}],"wp:attachment":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1167"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1167"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1167"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}