{"id":8839,"date":"2023-02-09T02:23:31","date_gmt":"2023-02-08T18:23:31","guid":{"rendered":"https:\/\/blog.iyatt.com\/?p=8839"},"modified":"2025-06-08T09:24:48","modified_gmt":"2025-06-08T01:24:48","slug":"powershell-%e8%84%9a%e6%9c%ac%e5%9f%ba%e7%a1%80%ef%bc%88%e7%bc%96%e8%be%91%e4%b8%ad%ef%bc%89","status":"publish","type":"post","link":"https:\/\/blog.iyatt.com\/?p=8839","title":{"rendered":"PowerShell 7 \u57fa\u7840"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 ez-toc-wrap-center counter-hierarchy ez-toc-counter ez-toc-light-blue ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title ez-toc-toggle\" style=\"cursor:pointer\">\u76ee\u5f55<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E7%8E%AF%E5%A2%83\" >\u73af\u5883<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E6%B3%A8%E6%84%8F\" >\u6ce8\u610f<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E5%A4%A7%E5%B0%8F%E5%86%99%E5%8C%BA%E5%88%86\" >\u5927\u5c0f\u5199\u533a\u5206<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E8%B7%A8%E5%B9%B3%E5%8F%B0\" >\u8de8\u5e73\u53f0<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E8%84%9A%E6%9C%AC%E6%89%A7%E8%A1%8C%E7%AD%96%E7%95%A5\" >\u811a\u672c\u6267\u884c\u7b56\u7565<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E6%B3%A8%E9%87%8A\" >\u6ce8\u91ca<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E5%8D%95%E8%A1%8C\" >\u5355\u884c<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E5%A4%9A%E8%A1%8C\" >\u591a\u884c<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E6%B8%85%E5%B1%8F\" >\u6e05\u5c4f<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E5%AD%97%E7%AC%A6%E4%B8%B2\" >\u5b57\u7b26\u4e32<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E5%AD%97%E7%AC%A6%E4%B8%B2%E6%A0%BC%E5%BC%8F%E5%8C%96\" >\u5b57\u7b26\u4e32\u683c\u5f0f\u5316<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E8%BD%AC%E4%B9%89%E5%AD%97%E7%AC%A6\" >\u8f6c\u4e49\u5b57\u7b26<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E5%AF%B9%E8%B1%A1%E6%96%B9%E6%B3%95\" >\u5bf9\u8c61\u65b9\u6cd5<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E5%AD%97%E7%AC%A6%E4%B8%B2%E5%88%86%E5%89%B2\" >\u5b57\u7b26\u4e32\u5206\u5272<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E7%BB%93%E5%B0%BE%E5%88%A4%E6%96%AD\" >\u7ed3\u5c3e\u5224\u65ad<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E5%8C%85%E5%90%AB%E5%88%A4%E6%96%AD\" >\u5305\u542b\u5224\u65ad<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E6%AF%94%E8%BE%83\" >\u6bd4\u8f83<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-18\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E6%9F%A5%E6%89%BE\" >\u67e5\u627e<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-19\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E6%8F%92%E5%85%A5\" >\u63d2\u5165<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-20\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E6%9B%BF%E6%8D%A2\" >\u66ff\u6362<\/a><\/li><\/ul><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-21\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E8%BE%93%E5%85%A5%E8%BE%93%E5%87%BA\" >\u8f93\u5165\u8f93\u51fa<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-22\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E7%AE%A1%E9%81%93%E5%92%8C%E9%87%8D%E5%AE%9A%E5%90%91\" >\u7ba1\u9053\u548c\u91cd\u5b9a\u5411<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-23\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E6%95%B0%E5%AD%A6%E8%BF%90%E7%AE%97\" >\u6570\u5b66\u8fd0\u7b97<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-24\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E8%87%AA%E5%A2%9E%E8%87%AA%E5%87%8F\" >\u81ea\u589e\u81ea\u51cf<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-25\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E8%87%AA%E5%A2%9E\" >\u81ea\u589e<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-26\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E8%87%AA%E5%87%8F\" >\u81ea\u51cf<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-27\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#Path_%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F\" >Path \u73af\u5883\u53d8\u91cf<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-28\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E5%88%AB%E5%90%8D\" >\u522b\u540d<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-29\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E5%8F%98%E9%87%8F\" >\u53d8\u91cf<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-30\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E8%87%AA%E5%AE%9A%E4%B9%89%E5%8F%98%E9%87%8F\" >\u81ea\u5b9a\u4e49\u53d8\u91cf<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-31\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E8%87%AA%E5%8A%A8%E5%8C%96%E5%8F%98%E9%87%8F\" >\u81ea\u52a8\u5316\u53d8\u91cf<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-32\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F\" >\u73af\u5883\u53d8\u91cf<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-33\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E5%91%BD%E4%BB%A4%E8%A1%8C%E4%BC%A0%E5%8F%82\" >\u547d\u4ee4\u884c\u4f20\u53c2<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-34\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E6%9D%A1%E4%BB%B6\" >\u6761\u4ef6<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-35\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E8%BF%90%E7%AE%97%E7%AC%A6\" >\u8fd0\u7b97\u7b26<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-36\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E6%AF%94%E8%BE%83%E8%BF%90%E7%AE%97%E7%AC%A6\" >\u6bd4\u8f83\u8fd0\u7b97\u7b26<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-37\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E9%9B%86%E5%90%88%E8%BF%90%E7%AE%97%E7%AC%A6\" >\u96c6\u5408\u8fd0\u7b97\u7b26<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-38\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E9%80%BB%E8%BE%91%E8%BF%90%E7%AE%97%E7%AC%A6\" >\u903b\u8f91\u8fd0\u7b97\u7b26<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-39\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E4%BD%8D%E8%BF%90%E7%AE%97%E7%AC%A6\" >\u4f4d\u8fd0\u7b97\u7b26<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-40\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#if_%E6%9D%A1%E4%BB%B6%E5%88%A4%E6%96%AD\" >if \u6761\u4ef6\u5224\u65ad<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-41\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#switch_%E6%9D%A1%E4%BB%B6%E5%88%A4%E6%96%AD\" >switch \u6761\u4ef6\u5224\u65ad<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-42\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E5%BE%AA%E7%8E%AF%E7%BB%93%E6%9E%84\" >\u5faa\u73af\u7ed3\u6784<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-43\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#foreach\" >foreach<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-44\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#while\" >while<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-45\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#do-while\" >do-while<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-46\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#for\" >for<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-47\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#switch\" >switch<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-48\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E6%95%B0%E7%BB%84\" >\u6570\u7ec4<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-49\" href=\"https:\/\/blog.iyatt.com\/?p=8839\/#%E8%87%AA%E5%AE%9A%E4%B9%89%E5%87%BD%E6%95%B0\" >\u81ea\u5b9a\u4e49\u51fd\u6570<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"%E7%8E%AF%E5%A2%83\"><\/span>\u73af\u5883<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Windows 11 \u4e13\u4e1a\u5de5\u4f5c\u7ad9\u7248 22H2<br \/>\nPowerShell 7.3.3<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1679012656168.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 492px; --smush-placeholder-aspect-ratio: 492\/262;\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E6%B3%A8%E6%84%8F\"><\/span>\u6ce8\u610f<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"%E5%A4%A7%E5%B0%8F%E5%86%99%E5%8C%BA%E5%88%86\"><\/span>\u5927\u5c0f\u5199\u533a\u5206<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Windows \u4e0d\u533a\u5206\u5927\u5c0f\u5199\uff0c\u4f46\u662f\u5728 Linux \u4e0b\u4f1a\u533a\u5206\uff0c\u6240\u4ee5\u5982\u679c\u6d89\u53ca\u5230\u8bfb\u5199\u6587\u4ef6\u540c\u65f6\u8981\u6c42\u8de8\u5e73\u53f0\u65f6\u5c31\u8981\u6ce8\u610f\u8fd9\u4e2a\u95ee\u9898\uff0c\u5f53\u7136\u53d8\u91cf\u547d\u540d\u8fd9\u4e9b\u662f PS \u5185\u90e8\u7684\u64cd\u4f5c\u5c31\u4e0d\u533a\u5206\u5927\u5c0f\u5199<\/p>\n<h3><span class=\"ez-toc-section\" id=\"%E8%B7%A8%E5%B9%B3%E5%8F%B0\"><\/span>\u8de8\u5e73\u53f0<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>PowerShell \u4e0d\u4ec5\u9650\u4e8e Windows\uff0c\u5728\u591a\u4e2a\u5e73\u53f0\u90fd\u6709\u652f\u6301\uff0c\u6bd4\u5982 macOS\u3001Linux\uff08Ubuntu\u3001Debian\u3001\u6811\u8393\u6d3e\u7cfb\u7edf&#8230;\uff09\u7b49\u7b49\uff0c\u53ea\u662f\u548c Windows \u662f\u540c\u4e00\u5bb6\uff0c\u6240\u4ee5 Windows \u662f\u9884\u88c5\u7684\uff0c\u6709\u4ee3\u66ff\u547d\u4ee4\u63d0\u793a\u7b26\uff08CMD\uff09\u7684\u8d8b\u52bf<br \/>\n\u5b89\u88c5 PowerShell \u53ef\u53c2\u8003\uff1a<a href=\"https:\/\/learn.microsoft.com\/zh-cn\/powershell\/scripting\/install\/installing-powershell\">https:\/\/learn.microsoft.com\/zh-cn\/powershell\/scripting\/install\/installing-powershell<\/a><\/p>\n<h3><span class=\"ez-toc-section\" id=\"%E8%84%9A%E6%9C%AC%E6%89%A7%E8%A1%8C%E7%AD%96%E7%95%A5\"><\/span>\u811a\u672c\u6267\u884c\u7b56\u7565<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Windows \u4e0b PowerShell \u53ef\u80fd\u9ed8\u8ba4\u72b6\u6001\u662f\u7981\u6b62\u8fd0\u884c\u811a\u672c\u6587\u4ef6\u7684<br \/>\n\u4fee\u6539\u53c2\u8003\uff1a<a href=\"https:\/\/blog.iyatt.com\/?p=10735\">https:\/\/blog.iyatt.com\/?p=10735<\/a><\/p>\n<pre><code>### Shebang \u884c\n\n\u5728 Windows \u4e0b\u6267\u884c .ps1 \u6269\u5c55\u540d\u7684\u6587\u4ef6\u4f1a\u81ea\u52a8\u4f7f\u7528 PowerShell \u4f5c\u4e3a\u89e3\u91ca\u5668\uff0c\u4f46\u662f\u5982\u679c\u5728 Linux \u7cfb\u7edf\u4e0b\u5c31\u9700\u8981\u5199 Shebang \u884c\u6765\u6307\u5b9a\u89e3\u91ca\u5668\uff0c\u5373\u5728\u9996\u884c\u5199\u4e0a\n```bash\n#!\/usr\/bin\/env pwsh<\/code><\/pre>\n<p>\u56e0\u4e3a\u4ee5 # \u5f00\u5934\uff0c\u5728 Windows \u4e0b\u7684\u65f6\u5019\u5c31\u76f4\u63a5\u5f53\u505a\u6ce8\u91ca\u5ffd\u7565\u4e86\uff0c\u5728 Linux \u4e0b\u5c31\u4f1a\u6839\u636e Shebang \u884c\u5185\u5bb9\u53bb\u5bfb\u627e\u5bf9\u5e94\u7684\u89e3\u91ca\u5668\u6267\u884c\uff0cpwsh \u5c31\u662f PowerShell \u89e3\u91ca\u5668\uff08\u7248\u672c 7 \u53ca\u4ee5\u4e0a\u624d\u662f pwsh\uff0c\u5426\u5219\u5c31\u662f powershell\uff09<\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E6%B3%A8%E9%87%8A\"><\/span>\u6ce8\u91ca<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"%E5%8D%95%E8%A1%8C\"><\/span>\u5355\u884c<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre><code class=\"language-bash\"># \u8f93\u51fa\u4e00\u53e5\u8bdd\nWrite-Output \u4f60\u597d,\u4e16\u754c\uff01<\/code><\/pre>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675874202192.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 227px; --smush-placeholder-aspect-ratio: 227\/80;\" \/><\/p>\n<h3><span class=\"ez-toc-section\" id=\"%E5%A4%9A%E8%A1%8C\"><\/span>\u591a\u884c<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre><code class=\"language-bash\"><# \u8fd9\u91cc\u662f\n    \u88ab\u6ce8\u91ca\n    \u7684\u5185\u5bb9 #>\nWrite-Output \u4f60\u597d,\u4e16\u754c\uff01<\/code><\/pre>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675874274601.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 199px; --smush-placeholder-aspect-ratio: 199\/100;\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E6%B8%85%E5%B1%8F\"><\/span>\u6e05\u5c4f<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u5728 CMD \u4e2d\u6e05\u5c4f\u662f\u4f7f\u7528\u7684 cls \u547d\u4ee4\uff0cPS \u4e5f\u652f\u6301\uff0c\u53e6\u5916 PS \u4e2d\u8fd8\u53ef\u4ee5\u4f7f\u7528 clear \u547d\u4ee4\u6216\u8005\u6309 Ctrl+L\uff0c\u8fd9\u4e00\u70b9\u548c Linux \u7ec8\u7aef\u4e00\u6837\u4e86\u3002<br \/>\n\u4e0d\u8fc7\u5b9e\u9645\u4e0a\uff0cPS \u4e2d\u4e0d\u7ba1 cls \u8fd8\u662f clear\uff0c\u5b83\u4eec\u5176\u5b9e\u90fd\u662f\u7ed9 Clear-Host \u547d\u4ee4\u8d77\u7684\u522b\u540d\uff0c\u6240\u4ee5\u4e5f\u53ef\u4ee5\u76f4\u63a5\u7528\u8fd9\u4e2a\u547d\u4ee4<\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E5%AD%97%E7%AC%A6%E4%B8%B2\"><\/span>\u5b57\u7b26\u4e32<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u6ce8\u610f\u5355\u5f15\u53f7\u548c\u53cc\u5f15\u53f7<\/p>\n<h3><span class=\"ez-toc-section\" id=\"%E5%AD%97%E7%AC%A6%E4%B8%B2%E6%A0%BC%E5%BC%8F%E5%8C%96\"><\/span>\u5b57\u7b26\u4e32\u683c\u5f0f\u5316<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\uff08\u4ec5\u4f7f\u7528 -f \u65f6\u53ef\u4ee5\u4f7f\u7528\u5355\u5f15\u53f7\uff09<\/p>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675965801490.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 461px; --smush-placeholder-aspect-ratio: 461\/169;\" \/><\/p>\n<h3><span class=\"ez-toc-section\" id=\"%E8%BD%AC%E4%B9%89%E5%AD%97%E7%AC%A6\"><\/span>\u8f6c\u4e49\u5b57\u7b26<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\uff08\u5fc5\u987b\u4f7f\u7528\u53cc\u5f15\u53f7\uff09<\/p>\n<p>\u8f6c\u4e49\u5b57\u7b26\u4e0e\u4e00\u822c\u4f7f\u7528\u53cd\u659c\u6760 \\ \u4e0d\u540c\uff0cPS \u4f7f\u7528\u53cd\u5355\u5f15\u53f7 \\` \uff0c\u6570\u5b57 1 \u952e\u7684\u5de6\u8fb9<\/p>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675965945419.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 262px; --smush-placeholder-aspect-ratio: 262\/119;\" \/><\/p>\n<p>\u53cc\u5f15\u53f7\u5b57\u7b26\u4e32\u4e2d\u663e\u793a\u5f15\u53f7<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675966101913.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 273px; --smush-placeholder-aspect-ratio: 273\/106;\" \/><\/p>\n<p>\u5355\u5f15\u53f7\u5b57\u7b26\u4e32\u663e\u793a\u5f15\u53f7<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675966324218.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 272px; --smush-placeholder-aspect-ratio: 272\/77;\" \/><\/p>\n<h3><span class=\"ez-toc-section\" id=\"%E5%AF%B9%E8%B1%A1%E6%96%B9%E6%B3%95\"><\/span>\u5bf9\u8c61\u65b9\u6cd5<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u90e8\u5206\u4e3e\u4f8b<\/p>\n<h4><span class=\"ez-toc-section\" id=\"%E5%AD%97%E7%AC%A6%E4%B8%B2%E5%88%86%E5%89%B2\"><\/span>\u5b57\u7b26\u4e32\u5206\u5272<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675967222304.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 585px; --smush-placeholder-aspect-ratio: 585\/301;\" \/><\/p>\n<h4><span class=\"ez-toc-section\" id=\"%E7%BB%93%E5%B0%BE%E5%88%A4%E6%96%AD\"><\/span>\u7ed3\u5c3e\u5224\u65ad<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675967376128.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 394px; --smush-placeholder-aspect-ratio: 394\/67;\" \/><\/p>\n<h4><span class=\"ez-toc-section\" id=\"%E5%8C%85%E5%90%AB%E5%88%A4%E6%96%AD\"><\/span>\u5305\u542b\u5224\u65ad<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675967447415.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 345px; --smush-placeholder-aspect-ratio: 345\/71;\" \/><\/p>\n<h4><span class=\"ez-toc-section\" id=\"%E6%AF%94%E8%BE%83\"><\/span>\u6bd4\u8f83<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675967629164.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 316px; --smush-placeholder-aspect-ratio: 316\/227;\" \/><\/p>\n<h4><span class=\"ez-toc-section\" id=\"%E6%9F%A5%E6%89%BE\"><\/span>\u67e5\u627e<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675967714351.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 300px; --smush-placeholder-aspect-ratio: 300\/165;\" \/><\/p>\n<h4><span class=\"ez-toc-section\" id=\"%E6%8F%92%E5%85%A5\"><\/span>\u63d2\u5165<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675967821282.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 350px; --smush-placeholder-aspect-ratio: 350\/77;\" \/><\/p>\n<h4><span class=\"ez-toc-section\" id=\"%E6%9B%BF%E6%8D%A2\"><\/span>\u66ff\u6362<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675967888780.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 371px; --smush-placeholder-aspect-ratio: 371\/84;\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E8%BE%93%E5%85%A5%E8%BE%93%E5%87%BA\"><\/span>\u8f93\u5165\u8f93\u51fa<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ul>\n<li>\n<p>Write-Output\uff1a\u5982\u679c\u6709\u63a5\u89e6\u8fc7\u6279\u5904\u7406\uff0c\u4e00\u4e2a\u5bf9 echo \u6bd4\u8f83\u719f\u6089\uff0c\u800c echo \u5c31\u662f Write-Output \u7684\u522b\u540d\u3002\u7528\u4e8e\u5c06\u6307\u5b9a\u7684 \u5bf9\u8c61\u5199\u5165\u7ba1\u9053\u3002 \u5982\u679c Write-Output \u662f\u7ba1\u9053\u4e2d\u7684\u6700\u540e\u4e00\u4e2a\u547d\u4ee4\uff0c\u5219\u5bf9\u8c61\u5c06\u663e\u793a\u5728\u63a7\u5236\u53f0\u4e2d\u3002<\/p>\n<\/li>\n<li>\n<p>Write-Host\uff1a\u5c06\u81ea\u5b9a\u4e49\u7684\u8f93\u51fa\u5199\u5165\u4e3b\u673a\u3002<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675966789910.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 362px; --smush-placeholder-aspect-ratio: 362\/143;\" \/><\/p>\n<\/li>\n<li>\n<p>Read-Host\uff1a\u4ece\u63a7\u5236\u53f0\u8bfb\u53d6\u4e00\u884c\u8f93\u5165\u3002<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675966923468.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 412px; --smush-placeholder-aspect-ratio: 412\/146;\" \/><\/p>\n<\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"%E7%AE%A1%E9%81%93%E5%92%8C%E9%87%8D%E5%AE%9A%E5%90%91\"><\/span>\u7ba1\u9053\u548c\u91cd\u5b9a\u5411<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u76f4\u63a5\u6267\u884c Get-ChildItem\uff0c\u663e\u793a\u7684\u662f\u6307\u5b9a\u8def\u5f84\u4e0b\u7684\u6587\u4ef6\u7684\u591a\u9879\u4fe1\u606f\uff0c\u770b\u5217\u6807<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675873511821.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 426px; --smush-placeholder-aspect-ratio: 426\/152;\" \/><\/p>\n<p>\u8fd9\u91cc\u6211\u8981\u5339\u914d Name \u5217\uff0c\u5e76\u5c06\u5185\u5bb9\u5199\u5230\u4e00\u4e2a\u6587\u4ef6\u4e2d<\/p>\n<pre><code class=\"language-bash\">Get-ChildItem D: | Format-Table Name > D:\\fileNames.txt<\/code><\/pre>\n<p>\u201cGet-ChildItem D:\u201d \u83b7\u53d6\u5230 D: \u8def\u5f84\u4e0b\u6587\u4ef6\u4fe1\u606f\u540e\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9 \u201cFormat-Table Name\u201d \u7b5b\u9009\u51fa Name \u5217\u5185\u5bb9\uff0c\u5982\u679c\u6ca1\u6709\u540e\u9762\u7684\u6307\u4ee4\uff0c\u7ed3\u679c\u4f1a\u76f4\u63a5\u5728\u63a7\u5236\u53f0\u663e\u793a\uff0c\u4f46\u662f\u8fd9\u91cc\u4f7f\u7528\u4e86\u4e00\u4e2a\u91cd\u5b9a\u5411\uff0c\u5c06\u5176\u5b9a\u5411\u5230\u4e00\u4e2a\u6587\u4ef6\uff0c\u90a3\u4e48\u5b83\u5c31\u4f1a\u628a\u672c\u6765\u8981\u663e\u793a\u7684\u5185\u5bb9\u4fdd\u5b58\u5230\u8fd9\u4e2a\u6587\u4ef6\u91cc<\/p>\n<p>\\&gt; \u4ee3\u8868\u7684\u5c31\u662f\u521b\u5efa\u6216\u8005\u8986\u76d6\u5199\u5165\uff0c\u800c &gt;&gt; \u5219\u662f\u521b\u5efa\u6216\u8ffd\u52a0\u5199\u5165<\/p>\n<pre><code class=\"language-bash\">Write-Output \u4f60\u597d\uff0c\u9644\u52a0\u4e00\u884c >> D:\\fileNames.txt<\/code><\/pre>\n<p>\u4e24\u6761\u547d\u4ee4\u6267\u884c\u4ee5\u540e\uff0c\u67e5\u770b\u6587\u4ef6\u5185\u5bb9<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675873972194.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 373px; --smush-placeholder-aspect-ratio: 373\/660;\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E6%95%B0%E5%AD%A6%E8%BF%90%E7%AE%97\"><\/span>\u6570\u5b66\u8fd0\u7b97<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u8fd9\u4e2a\u5c31\u6ca1\u5565\u8bf4\u7684\u4e86\uff0c\u53cd\u6b63\u53ef\u4ee5\u5f53\u8ba1\u7b97\u5668\u7528<\/p>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675875609469.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 296px; --smush-placeholder-aspect-ratio: 296\/231;\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E8%87%AA%E5%A2%9E%E8%87%AA%E5%87%8F\"><\/span>\u81ea\u589e\u81ea\u51cf<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"%E8%87%AA%E5%A2%9E\"><\/span>\u81ea\u589e<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre><code class=\"language-bash\">$a = 1\n++$a\nWrite-Output $a\n$a++\nWrite-Output $a<\/code><\/pre>\n<pre><code class=\"language-bash\">$a = 1\n$b = $a++ # \u8fd4\u56de\u81ea\u589e\u524d\u7684\u503c\nWrite-Output $a $b<\/code><\/pre>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675954416157.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 73px; --smush-placeholder-aspect-ratio: 73\/51;\" \/><\/p>\n<pre><code class=\"language-bash\">$a = 1\n$b = ++$a # \u8fd4\u56de\u81ea\u589e\u540e\u7684\u503c\nWrite-Output $a $b<\/code><\/pre>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675954452297.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 46px; --smush-placeholder-aspect-ratio: 46\/39;\" \/><\/p>\n<h3><span class=\"ez-toc-section\" id=\"%E8%87%AA%E5%87%8F\"><\/span>\u81ea\u51cf<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre><code class=\"language-bash\">$a = 5\n--$a\nWrite-Output $a\n$a--\nWrite-Output $a<\/code><\/pre>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675954723520.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 52px; --smush-placeholder-aspect-ratio: 52\/42;\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Path_%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F\"><\/span>Path \u73af\u5883\u53d8\u91cf<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u5728 PS \u4e2d\u6267\u884c\u7684\u5404\u79cd\u547d\u4ee4\uff0c\u8bf4\u5230\u5e95\u5b83\u4eec\u90fd\u662f\u4e00\u4e2a\u4e2a\u7a0b\u5e8f\u3002\u5728\u6267\u884c\u547d\u4ee4\u7684\u65f6\u5019\uff0cPS \u4f1a\u53bb\u6307\u5b9a\u7684\u8def\u5f84\u67e5\u770b\u662f\u5426\u5b58\u5728\u8fd9\u4e2a\u7a0b\u5e8f\u6587\u4ef6\uff0c\u5b58\u5728\u5c31\u6267\u884c\uff0c\u4e0d\u5b58\u5728\u65f6\u5219\u62a5\u9519\uff1a<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675876093549.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 442px; --smush-placeholder-aspect-ratio: 442\/400;\" \/><br \/>\n\u800c\u8fd9\u4e2a\u67e5\u770b\u7684\u8def\u5f84\u5c31\u662f Path \u53d8\u91cf\u4e2d\u4fdd\u5b58\u7684\u8def\u5f84<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675876160911.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 670px; --smush-placeholder-aspect-ratio: 670\/327;\" \/><\/p>\n<p>\u6216\u8bb8\u53ef\u80fd\u4f1a\u60f3\u4e3a\u5565\u8981\u8fd9\u4e2a Path \u53d8\u91cf\uff0c\u4e3a\u4ec0\u4e48\u4e0d\u8ba9 PS \u81ea\u5df1\u53bb\u6328\u7740\u627e\u3002\u90a3\u4e48\u8bf7\u5148\u8bd5\u8bd5\u6253\u5f00\u6587\u4ef6\u8d44\u6e90\u7ba1\u7406\u5668\uff0c\u5728 C \u76d8\u4e2d\u641c\u7d22\u4e00\u4e2a\u6587\u4ef6\u540d\uff0c\u4f60\u770b\u770b\u4f1a\u82b1\u591a\u5c11\u65f6\u95f4\u3002\u6709\u65f6\u5019\u8fd8\u9700\u8981\u4e00\u4e9b\u81ea\u5b9a\u4e49\u7684\uff0c\u4e0d\u4e00\u5b9a\u5728 C \u76d8\uff0c\u90a3\u5c31\u662f\u6240\u6709\u76d8\u90fd\u5f97\u641c\u4e00\u904d\u3002\u90a3\u4e48\u653e\u5728 PS \u6267\u884c\u4e0a\uff0c\u6bcf\u6572\u4e00\u4e2a\u547d\u4ee4\u90fd\u5f97\u7b49\u4e00\u4f1a\u3002\u90a3\u4e0d\u5982\u76f4\u63a5\u6307\u5b9a\u8def\u5f84\uff0c\u800c\u4e14\u7cfb\u7edf\u7684\u547d\u4ee4\u4e5f\u96c6\u4e2d\u5728\u90a3\u51e0\u4e2a\u8def\u5f84\uff0c\u66f4\u9ad8\u6548\u7387\u3002<\/p>\n<p>\u9700\u8981\u81ea\u5b9a\u4e49 Path \u53d8\u91cf\u7684\uff0c\u6709\u4e9b\u662f\u8f6f\u4ef6\u5b89\u88c5\u7684\u65f6\u5019\uff0c\u53ef\u4ee5\u52fe\u9009\u81ea\u52a8\u6dfb\u52a0\uff0c\u6bd4\u5982 Python<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675876689739.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 648px; --smush-placeholder-aspect-ratio: 648\/406;\" \/><\/p>\n<p>\u8fd8\u6709\u4e9b\uff0c\u53ef\u80fd\u5b89\u88c5\u7a0b\u5e8f\u6ca1\u6709\u63d0\u4f9b\u81ea\u52a8\u6dfb\u52a0\uff0c\u53c8\u6216\u8005\u662f\u7eff\u8272\u7248\u65e0\u5b89\u88c5\u7684\u8f6f\u4ef6\uff0c\u6bd4\u5982 <a href=\"https:\/\/blog.iyatt.com\/?p=8613\">FFmpeg<\/a>\uff0c\u7b2c\u4e09\u65b9\u63d0\u4f9b\u7684 Windows \u7f16\u8bd1\u7248\uff0c\u5c31\u662f\u51e0\u4e2a\u53ef\u6267\u884c\u7a0b\u5e8f\uff0c\u7a0b\u5e8f\u6587\u4ef6\u4f4d\u7f6e\u968f\u4fbf\u4f60\u81ea\u5df1\u653e\uff0c\u7136\u540e\u8bbe\u7f6e Path \u53d8\u91cf\uff0c\u5199\u5165\u4f60\u7a0b\u5e8f\u6587\u4ef6\u653e\u7f6e\u7684\u7edd\u5bf9\u8def\u5f84\u3002<\/p>\n<p>\u8bbe\u7f6e\u65b9\u6cd5\u7684\u8bdd\uff0c\u6253\u5f00\u63a7\u5236\u9762\u677f-&gt;\u7cfb\u7edf\u548c\u5b89\u5168-&gt;\u7cfb\u7edf\uff0c\u70b9\u51fb\u5de6\u4fa7\u9ad8\u7ea7\u7cfb\u7edf\u8bbe\u7f6e<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/01\/image-1675877065681.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 769px; --smush-placeholder-aspect-ratio: 769\/582;\" \/><\/p>\n<p>\u70b9\u5230\u9ad8\u7ea7-\u73af\u5883\u53d8\u91cf<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/01\/image-1674960172559.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 478px; --smush-placeholder-aspect-ratio: 478\/599;\" \/><\/p>\n<p>\u4e0a\u9762\u662f xxx \u7684\u7528\u6237\u53d8\u91cf\uff0c\u5c31\u662f\u5f53\u524d\u767b\u5f55\u7684\u8d26\u53f7\u5bf9\u5e94\u7684\u53d8\u91cf\uff0c\u4e0b\u9762\u7684\u7cfb\u7edf\u53d8\u91cf\u5c31\u662f\u5bf9\u6240\u6709\u7528\u6237\u6709\u6548\uff0c\u5982\u679c\u8bbe\u7f6e\u4e86\uff0c\u4f60\u7535\u8111\u4e0a\u7684\u5176\u5b83\u7528\u6237\u8d26\u53f7\u4e5f\u4f1a\u751f\u6548\uff08\u5982\u679c\u662f\u591a\u7528\u6237\u7684\u8bdd\uff09\uff0c\u4e00\u822c\u7cfb\u7edf\u7684\u73af\u5883\u53d8\u91cf\u5c31\u8bbe\u7f6e\u5728\u4e0b\u9762\uff0c\u7528\u6237\u81ea\u5b9a\u4e49\u7684\u8bbe\u7f6e\u4e0a\u9762\u7684\u5c31\u884c<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/01\/image-1674960186153.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 615px; --smush-placeholder-aspect-ratio: 615\/665;\" \/><br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675877421947.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 445px; --smush-placeholder-aspect-ratio: 445\/494;\" \/><\/p>\n<p>\u8981\u4fee\u6539\u7684\u8bdd\uff0c\u53cc\u51fb Path<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675877453105.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 250px; --smush-placeholder-aspect-ratio: 250\/209;\" \/><br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675877466321.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 442px; --smush-placeholder-aspect-ratio: 442\/204;\" \/><\/p>\n<p>\u4e0a\u9762\u8bf4\u7684\u662f\u6c38\u4e45\u751f\u6548\u7684\u4fee\u6539\u65b9\u5f0f\uff0c\u5982\u679c\u662f\u4e34\u65f6\u4fee\u6539\u7684\u8bdd\uff0c\u76f4\u63a5\u4fee\u6539 $env:Path \u53d8\u91cf\uff0c\u8fd9\u4e2a\u4fee\u6539\u53ea\u5bf9\u5f53\u524d\u7684 PS \u7a97\u53e3\u6709\u6548\uff0c\u6362\u4e00\u4e2a\u5c31\u6ca1\u6709\u7528\u4e86\u3002\u53ef\u4ee5\u8fd9\u6837\u7406\u89e3\uff0c\u5f53\u4f60\u6253\u5f00\u4e00\u4e2a PS \u7a97\u53e3\u65f6\uff0cPS \u4f1a\u53bb Path \u8bbe\u7f6e\u6587\u4ef6\u4e2d\u8bfb\u53d6\u5176\u4e2d\u4fdd\u5b58\u7684\u53d8\u91cf\u503c\uff0c\u5e76\u5b58\u5230 $env:Path \u4e2d\uff0c\u53e6\u5916\u6253\u5f00\u4e00\u4e2a PS \u7a97\u53e3\uff0c\u5b83\u4e5f\u662f\u8fd9\u6837\u64cd\u4f5c\uff0c\u76f8\u5f53\u4e8e\u6bcf\u4e2a PS \u7a97\u53e3\u6709\u4e2a\u81ea\u5df1\u7684 $env:Path \u3002\u6240\u4ee5\u8981\u6c38\u4e45\u6709\u6548\uff0c\u5c31\u5f97\u53bb\u8bbe\u7f6e\u4fee\u6539\uff0c\u53ea\u662f\u4fee\u6539 $env:Path ,\u4fee\u6539\u7684\u4e5f\u662f\u81ea\u5df1\u7684\uff0c\u5173\u95ed\u4e86\u8fd9\u4e2a PS \u7a97\u53e3\u5b83\u4e5f\u5c31\u6d88\u5931\u4e86\u3002<\/p>\n<p>\u800c Path \u53d8\u91cf\u8bbe\u7f6e\u7684\u89c4\u5219\uff0c\u8def\u5f84\u8981\u7528\u7edd\u5bf9\u8def\u5f84\uff0c\u5373\u4ece\u76d8\u7b26\u5f00\u59cb\uff0c\u6bcf\u4e2a\u8def\u5f84\u4ee5\u82f1\u6587\u5206\u53f7\u7ed3\u675f\u3002\u5047\u5982\u6211\u8981\u4e34\u65f6\u65b0\u6dfb\u52a0\u4e00\u4e2a\u73af\u5883\u53d8\u91cf D:\\Program Files\\ffmpeg\\\uff0c\u53ef\u4ee5\u6267\u884c\u4e00\u4e0b<\/p>\n<pre><code class=\"language-bash\">$env:Path = $env:Path + 'D:\\Program Files\\ffmpeg\\;'<\/code><\/pre>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675878415701.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 672px; --smush-placeholder-aspect-ratio: 672\/355;\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E5%88%AB%E5%90%8D\"><\/span>\u522b\u540d<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u524d\u9762\u8bf4\u6e05\u5c4f\u7684\u65f6\u5019\uff0c\u6211\u5c31\u8bf4 cls \u548c clear \u90fd\u662f Clear-Host \u7684\u522b\u540d\u3002\u8fd9\u4e2a\u53ef\u4ee5\u4f7f\u7528 Get-Alias \u547d\u4ee4\u67e5\u770b<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/01\/image-1675879314683.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 319px; --smush-placeholder-aspect-ratio: 319\/197;\" \/><\/p>\n<p>\u5982\u679c\u8981\u8bbe\u7f6e\u522b\u540d\u7684\u8bdd\uff08\u4e34\u65f6\u5f53\u524d\u7a97\u53e3\u6709\u6548\uff09\uff0c\u53ef\u4ee5\u4f7f\u7528 Set-Alias<br \/>\n\u8fd9\u91cc\u6211\u4e3a clear \u53d6\u522b\u540d\u4e3a aaa\uff0c\u800c clear \u6307\u5411 Clear-Host\uff0c\u6700\u7ec8 aaa \u5c31\u6307\u5411 Clear-Host<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/01\/image-1675879786073.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 466px; --smush-placeholder-aspect-ratio: 466\/192;\" \/><\/p>\n<p>\u5220\u9664\u522b\u540d\u4f7f\u7528 del\u3001rm \u6216 Remove-Item \u90fd\u53ef\u4ee5\uff08\u524d\u4e24\u4e2a\u662f\u6700\u540e\u4e00\u4e2a\u7684\u522b\u540d\uff09<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/01\/image-1675880049634.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 450px; --smush-placeholder-aspect-ratio: 450\/80;\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E5%8F%98%E9%87%8F\"><\/span>\u53d8\u91cf<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"%E8%87%AA%E5%AE%9A%E4%B9%89%E5%8F%98%E9%87%8F\"><\/span>\u81ea\u5b9a\u4e49\u53d8\u91cf<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u81ea\u5df1\u6839\u636e\u9700\u8981\u521b\u5efa\u53d8\u91cf\uff0c\u53d8\u91cf\u540d\u524d\u9762\u9700\u8981\u6dfb\u52a0\u7f8e\u5143\u7b26\u53f7 $\u3002\u53d8\u91cf\u4ec5\u5728\u5f53\u524d\u63a7\u5236\u53f0\u7a97\u53e3\u8fd0\u884c\u4e2d\u6709\u6548<\/p>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675916606479.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 440px; --smush-placeholder-aspect-ratio: 440\/252;\" \/><br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675918848840.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 397px; --smush-placeholder-aspect-ratio: 397\/196;\" \/><\/p>\n<p>\u67e5\u770b\u5f53\u524d\u63a7\u5236\u53f0\u4e2d\u4f7f\u7528\u7684\u53d8\u91cf<\/p>\n<pre><code class=\"language-bash\">ls Variable:<\/code><\/pre>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675919087735.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 450px; --smush-placeholder-aspect-ratio: 450\/299;\" \/><\/p>\n<p>\u67e5\u770b\u524d\u9762\u521b\u5efa\u7684\u53d8\u91cf<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675919141474.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 337px; --smush-placeholder-aspect-ratio: 337\/105;\" \/><\/p>\n<p>\u5220\u9664\u53d8\u91cf<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675919288592.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 548px; --smush-placeholder-aspect-ratio: 548\/76;\" \/><\/p>\n<h3><span class=\"ez-toc-section\" id=\"%E8%87%AA%E5%8A%A8%E5%8C%96%E5%8F%98%E9%87%8F\"><\/span>\u81ea\u52a8\u5316\u53d8\u91cf<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u81ea\u52a8\u5316\u53d8\u91cf\u5728 PS \u6253\u5f00\u65f6\u5c31\u4f1a\u521b\u5efa\uff0c\u6bd4\u5982<\/p>\n<p>$? \u662f\u4e0a\u4e00\u4e2a\u7a0b\u5e8f\u6267\u884c\u7684\u72b6\u6001\uff0c\u5982\u679c\u6709\u8fc7 C\/C++ \u7f16\u7a0b\u7ecf\u5386\u7684\u53ef\u4ee5\u8fd9\u6837\u7406\u89e3\uff0cmain \u51fd\u6570\u91cc\u7ed3\u675f\u65f6\u8fd4\u56de 0\uff0c$? \u5c31\u662f True\uff0c\u5982\u679c\u8fd4\u56de\u975e 0 \u503c\uff0c$? \u5c31\u662f False\u3002\u53ef\u4ee5\u7528\u4e8e\u5224\u65ad\u4e0a\u4e00\u4e2a\u547d\u4ee4\u662f\u5426\u6210\u529f\u6267\u884c<\/p>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675930436193.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 667px; --smush-placeholder-aspect-ratio: 667\/212;\" \/><br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675930588579.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 665px; --smush-placeholder-aspect-ratio: 665\/193;\" \/><\/p>\n<p>$HOME \u5bb6\u76ee\u5f55<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675931085846.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 569px; --smush-placeholder-aspect-ratio: 569\/48;\" \/><\/p>\n<p>$PID \u5f53\u524d PS \u7a97\u53e3\u7684\u8fdb\u7a0b\u6807\u8bc6\u7b26<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675931164026.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 568px; --smush-placeholder-aspect-ratio: 568\/89;\" \/><\/p>\n<p>\u8fd9\u91cc\u5c31\u5217\u4e3e\u51e0\u4e2a\u4f8b\u5b50\uff0c\u5b9e\u9645\u8fd8\u6709\u5f88\u591a<\/p>\n<h3><span class=\"ez-toc-section\" id=\"%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F\"><\/span>\u73af\u5883\u53d8\u91cf<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u524d\u9762\u8bf4\u5230\u7684 Path \u53d8\u91cf\u5c31\u662f\u73af\u5883\u53d8\u91cf\u7684\u4e00\u79cd\uff0c\u67e5\u770b\u73af\u5883\u53d8\u91cf<\/p>\n<pre><code class=\"language-bash\">ls env:<\/code><\/pre>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675931285032.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 972px; --smush-placeholder-aspect-ratio: 972\/626;\" \/><\/p>\n<p>\u53ea\u5728\u5f53\u524d\u7a97\u53e3\u4fee\u6539\u73af\u5883\u53d8\u91cf\u5c31\u64cd\u4f5c $env:XXXX=$env:XXXX + &#039;xxxxxxxxxx&#039; \u8fdb\u884c\u8ffd\u52a0\uff0c\u6216\u5219\u5bf9 $env:XXXX \u8d4b\u503c<br \/>\n\u8981\u6c38\u4e45\u751f\u6548\uff0c\u53ef\u4ee5\u53bb\u8bbe\u7f6e\u4fee\u6539\uff0c\u6216\u8005\u4f7f\u7528<\/p>\n<pre><code class=\"language-bash\"># \u83b7\u53d6\u65e7\u7684\u7528\u6237 Path \u73af\u5883\u53d8\u91cf\n$oldPath = [System.Environment]::GetEnvironmentVariable('Path', 'User')\n\n## \u62fc\u63a5\u65b0\u7684 Path\uff0c\u540e\u9762\u5b57\u7b26\u4e32\u5185\u5bb9\u6839\u636e\u81ea\u5df1\u5b9e\u9645\u9700\u8981\u6dfb\u52a0\n$newPath = $oldPath + 'D:\\abcd\\1234\\;'\n\n## \u8bbe\u7f6e\u65b0\u7684\u7528\u6237 Path \u53d8\u91cf\n[System.Environment]::SetEnvironmentVariable('Path', $newPath, 'User')<\/code><\/pre>\n<p>\u6267\u884c\u540e\u53ef\u4ee5\u5728\u8bbe\u7f6e\u53ef\u4ee5\u770b\u5230\u5df2\u7ecf\u6dfb\u52a0\u4e86<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675933151649.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 963px; --smush-placeholder-aspect-ratio: 963\/146;\" \/><br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675932861383.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 513px; --smush-placeholder-aspect-ratio: 513\/287;\" \/><\/p>\n<p>\u7136\u540e\u518d\u8bbe\u7f6e\u56de\u539f\u6765\u7684<\/p>\n<pre><code class=\"language-bash\">[System.Environment]::SetEnvironmentVariable('Path', $oldPath, 'User')<\/code><\/pre>\n<p>\u4fee\u6539 Path \u73af\u5883\u53d8\u91cf\u5efa\u8bae\u6309\u6211\u4e0a\u9762\u7684\u6d41\u7a0b\u6765\uff0cPath \u4e2d\u4e0d\u6b62\u4e00\u4e2a\u503c\uff0c\u4fee\u6539\u7684\u8bdd\u8981\u5728\u539f\u6765\u7684\u5c3e\u5df4\u8ffd\u52a0\uff0c\u522b\u76f4\u63a5\u4fee\u6539\u4e86\uff0c\u5230\u65f6\u5019\u628a\u5176\u5b83\u7684\u73af\u5883\u53d8\u91cf\u503c\u6e05\u6389\u4e86\u5c31\u5f88\u7cdf\u5fc3\u4e86\u3002<br \/>\n\u5373\u4f7f\u662f\u53ea\u6709\u4e00\u4e2a\u503c\u7684\u53d8\u91cf\u4e5f\u5efa\u8bae\u5148\u83b7\u53d6\u65e7\u503c\uff0c\u5907\u4efd\u4e00\u4e0b\uff0c\u907f\u514d\u6709\u95ee\u9898\u65f6\u6062\u590d\u539f\u6837<\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E5%91%BD%E4%BB%A4%E8%A1%8C%E4%BC%A0%E5%8F%82\"><\/span>\u547d\u4ee4\u884c\u4f20\u53c2<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u5982\u679c\u901a\u8fc7\u547d\u4ee4\u884c\u6267\u884c\u811a\u672c\u6587\u4ef6\uff0c\u60f3\u8981\u4f20\u5165\u53c2\u6570\uff0c\u90a3\u4e48\u5728\u811a\u672c\u5185\u53ef\u4ee5\u4f7f\u7528 $args \u83b7\u53d6\u53c2\u6570\u5185\u5bb9<\/p>\n<pre><code class=\"language-powershell\"># PowerShell\n\nWrite-Output (\"\u53c2\u6570\u4e2a\u6570\uff1a{0}\" -f $args.Length)\nWrite-Output $args[0]\nWrite-Output $args[1]\nWrite-Output $args[2]\n\nforeach ($arg in $args)\n{\n    Write-Output $arg\n}<\/code><\/pre>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1678983235678.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 632px; --smush-placeholder-aspect-ratio: 632\/210;\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E6%9D%A1%E4%BB%B6\"><\/span>\u6761\u4ef6<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"%E8%BF%90%E7%AE%97%E7%AC%A6\"><\/span>\u8fd0\u7b97\u7b26<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<h4><span class=\"ez-toc-section\" id=\"%E6%AF%94%E8%BE%83%E8%BF%90%E7%AE%97%E7%AC%A6\"><\/span>\u6bd4\u8f83\u8fd0\u7b97\u7b26<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<ul>\n<li>\n<p>\u7b49\u4e8e -eq<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675938503084.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 323px; --smush-placeholder-aspect-ratio: 323\/162;\" \/><\/p>\n<\/li>\n<li>\n<p>\u4e0d\u7b49\u4e8e -ne<\/p>\n<\/li>\n<li>\n<p>\u5927\u4e8e -gt<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675938536836.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 249px; --smush-placeholder-aspect-ratio: 249\/134;\" \/><br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675938599094.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 282px; --smush-placeholder-aspect-ratio: 282\/104;\" \/><\/p>\n<\/li>\n<li>\n<p>-ge \u5927\u4e8e\u7b49\u4e8e<\/p>\n<\/li>\n<li>\n<p>-lt \u5c0f\u4e8e<\/p>\n<\/li>\n<li>\n<p>-le \u5c0f\u4e8e\u7b49\u4e8e<\/p>\n<\/li>\n<li>\n<p>-like \u901a\u914d\u7b26\u5339\u914d\uff0c? \u5339\u914d\u5355\u4e2a\u5b57\u7b26\uff0c * \u5339\u914d\u4efb\u610f\u4e2a\u5b57\u7b26\uff08\u4e0d\u533a\u5206\u5927\u5c0f\u5199\uff0c\u533a\u5206\u7528 -clike\u3002\u4e00\u822c\u4e0d\u533a\u5206\u52a0 i\uff0c\u533a\u5206\u52a0 c\uff0c\u4e0b\u540c\uff09<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675940706796.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 356px; --smush-placeholder-aspect-ratio: 356\/180;\" \/><\/p>\n<\/li>\n<\/ul>\n<p>\u53cd\u8fc7\u6765\u4e0d\u5339\u914d\u5c31\u662f -notlike\uff0c\u4e00\u822c\u53d6\u53cd\u5411\u7684\u52a0 not\uff0c\u4e0b\u540c<\/p>\n<ul>\n<li>\n<p>-match \u6b63\u5219\u8868\u8fbe\u5f0f\uff08\u4e0d\u533a\u5206\u5927\u5c0f\u5199\uff09<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675941366858.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 328px; --smush-placeholder-aspect-ratio: 328\/133;\" \/><\/p>\n<\/li>\n<li>\n<p>-is \u5c5e\u4e8e\u7c7b\u578b<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675941463755.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 315px; --smush-placeholder-aspect-ratio: 315\/101;\" \/><\/p>\n<\/li>\n<\/ul>\n<h4><span class=\"ez-toc-section\" id=\"%E9%9B%86%E5%90%88%E8%BF%90%E7%AE%97%E7%AC%A6\"><\/span>\u96c6\u5408\u8fd0\u7b97\u7b26<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<ul>\n<li>\n<p>-contains \u5305\u542b\uff08\u4e0d\u533a\u5206\u5927\u5c0f\u5199\uff09<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675939546602.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 338px; --smush-placeholder-aspect-ratio: 338\/104;\" \/><\/p>\n<\/li>\n<li>\n<p>-in\uff08\u4e0d\u533a\u5206\u5927\u5c0f\u5199\uff09<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675941567563.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 264px; --smush-placeholder-aspect-ratio: 264\/78;\" \/><\/p>\n<\/li>\n<\/ul>\n<h4><span class=\"ez-toc-section\" id=\"%E9%80%BB%E8%BE%91%E8%BF%90%E7%AE%97%E7%AC%A6\"><\/span>\u903b\u8f91\u8fd0\u7b97\u7b26<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<ul>\n<li>\n<p>\u548c -and<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675939330288.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 250px; --smush-placeholder-aspect-ratio: 250\/132;\" \/><\/p>\n<\/li>\n<li>\n<p>\u6216 -or<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675939359991.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 248px; --smush-placeholder-aspect-ratio: 248\/131;\" \/><\/p>\n<\/li>\n<li>\n<p>\u5f02\u6216 -xor<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675939452394.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 254px; --smush-placeholder-aspect-ratio: 254\/132;\" \/><\/p>\n<\/li>\n<li>\n<p>\u9006 -not \u6216\u8005\u82f1\u6587\u611f\u53f9\u53f7 !<br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675939183653.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 294px; --smush-placeholder-aspect-ratio: 294\/150;\" \/><\/p>\n<\/li>\n<\/ul>\n<h4><span class=\"ez-toc-section\" id=\"%E4%BD%8D%E8%BF%90%E7%AE%97%E7%AC%A6\"><\/span>\u4f4d\u8fd0\u7b97\u7b26<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<ul>\n<li>-band \u4e8c\u8fdb\u5236\u548c<\/li>\n<li>-bor \u4e8c\u8fdb\u5236\u6216<\/li>\n<li>-bxor \u4e8c\u8fdb\u5236\u5f02\u6216<\/li>\n<li>-bnot \u4e8c\u8fdb\u5236\u975e<\/li>\n<li>-shl \u5de6\u79fb<\/li>\n<li>-shr \u53f3\u79fb<\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"if_%E6%9D%A1%E4%BB%B6%E5%88%A4%E6%96%AD\"><\/span>if \u6761\u4ef6\u5224\u65ad<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre><code class=\"language-bash\">$a = 5\n\nif ($a -eq 3)\n{\n    Write-Output '\u7b49\u4e8e 3'\n}\nelseif ($a -gt 3)\n{\n    Write-Output '\u5927\u4e8e 3'\n}\nelse\n{\n    Write-Output '\u5c0f\u4e8e 3'\n}<\/code><\/pre>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675955142878.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 67px; --smush-placeholder-aspect-ratio: 67\/36;\" \/><\/p>\n<h3><span class=\"ez-toc-section\" id=\"switch_%E6%9D%A1%E4%BB%B6%E5%88%A4%E6%96%AD\"><\/span>switch \u6761\u4ef6\u5224\u65ad<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre><code class=\"language-bash\">$abcdefghijklmn = 3\n\nswitch ($abcdefghijklmn)\n{\n    {$_ -gt 3}\n    {\n        Write-Output '\u5927\u4e8e 3'\n        break\n    }\n    3\n    {\n        Write-Output '\u7b49\u4e8e 3'\n        break\n    }\n    default\n    {\n        Write-Output '\u5c0f\u4e8e 3'\n        break\n    }\n}<\/code><\/pre>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675955120303.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 91px; --smush-placeholder-aspect-ratio: 91\/29;\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E5%BE%AA%E7%8E%AF%E7%BB%93%E6%9E%84\"><\/span>\u5faa\u73af\u7ed3\u6784<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"foreach\"><\/span>foreach<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre><code class=\"language-bash\">foreach ($file in dir 'D:\\Program Files')\n{\n    Write-Output $file\n}<\/code><\/pre>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675955075488.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 528px; --smush-placeholder-aspect-ratio: 528\/231;\" \/><\/p>\n<h3><span class=\"ez-toc-section\" id=\"while\"><\/span>while<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre><code class=\"language-bash\">$counter = 5\n\nwhile ($counter -gt 0)\n{\n    Write-Output $counter\n    --$counter\n}<\/code><\/pre>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675953783456.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 64px; --smush-placeholder-aspect-ratio: 64\/82;\" \/><\/p>\n<pre><code class=\"language-bash\">$counter = 0\n\nwhile ($true)\n{\n    ++$counter\n    if ($counter % 2 -ne 0)\n    {\n        continue\n    }\n    Write-Output $counter\n    if ($counter -eq 16)\n    {\n        break\n    }\n}<\/code><\/pre>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675953729093.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 91px; --smush-placeholder-aspect-ratio: 91\/135;\" \/><\/p>\n<h3><span class=\"ez-toc-section\" id=\"do-while\"><\/span>do-while<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre><code class=\"language-bash\">$counter = 5\n\ndo\n{\n    Write-Output $counter\n    --$counter\n}\nwhile ($counter -gt 0)<\/code><\/pre>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675953835576.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 78px; --smush-placeholder-aspect-ratio: 78\/82;\" \/><\/p>\n<h3><span class=\"ez-toc-section\" id=\"for\"><\/span>for<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre><code class=\"language-bash\">$sum = 0\nfor ($i = 0; $i -lt 100; ++$i)\n{\n    $sum += $i\n}\nWrite-Output $sum<\/code><\/pre>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675954934281.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 68px; --smush-placeholder-aspect-ratio: 68\/38;\" \/><\/p>\n<h3><span class=\"ez-toc-section\" id=\"switch\"><\/span>switch<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<pre><code class=\"language-bash\">$array = 1..10\n\nswitch ($array)\n{\n    {$_ % 2 -eq 0}\n    {\n        Write-Host $_ \u662f\u5076\u6570\n    }\n    default\n    {\n        Write-Host $_ \u662f\u5947\u6570\n    }\n}<\/code><\/pre>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675956736911.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 145px; --smush-placeholder-aspect-ratio: 145\/176;\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E6%95%B0%E7%BB%84\"><\/span>\u6570\u7ec4<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675956992348.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 447px; --smush-placeholder-aspect-ratio: 447\/100;\" \/><br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675957049349.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 425px; --smush-placeholder-aspect-ratio: 425\/226;\" \/><br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675957079841.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 343px; --smush-placeholder-aspect-ratio: 343\/169;\" \/><br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675957390909.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 695px; --smush-placeholder-aspect-ratio: 695\/174;\" \/><br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675957603711.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 441px; --smush-placeholder-aspect-ratio: 441\/278;\" \/><br \/>\n<img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675957669093.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 285px; --smush-placeholder-aspect-ratio: 285\/257;\" \/><\/p>\n<pre><code class=\"language-bash\">$a = 'a'..'k'\n\nfor ($i = 0; $i -lt $a.Count; ++$i)\n{\n    Write-Output $a[$i]\n}<\/code><\/pre>\n<pre><code class=\"language-bash\">$a = 'a'..'k'\n\nforeach ($i in $a)\n{\n    Write-Output $i\n}<\/code><\/pre>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675957915079.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 85px; --smush-placeholder-aspect-ratio: 85\/192;\" \/><\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E8%87%AA%E5%AE%9A%E4%B9%89%E5%87%BD%E6%95%B0\"><\/span>\u81ea\u5b9a\u4e49\u51fd\u6570<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<pre><code class=\"language-bash\">function add($num1, $num2)\n{\n    return $num1 + $num2\n}\n\n$result = add 3 5\nWrite-Output $result<\/code><\/pre>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675961406294.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 102px; --smush-placeholder-aspect-ratio: 102\/52;\" \/><\/p>\n<pre><code class=\"language-bash\">function createArray($num1, $num2, $num3, $num4)\n{\n    return $num1,$num2,$num3,$num4\n}\n\n$result = createArray \"b\" 5 \"abc\" 87\nWrite-Output $result<\/code><\/pre>\n<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/02\/image-1675961546679.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 66px; --smush-placeholder-aspect-ratio: 66\/87;\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u73af\u5883 Windows 11 \u4e13\u4e1a\u5de5\u4f5c\u7ad9\u7248 22H2 PowerShell 7.3.3 \u6ce8\u610f \u5927\u5c0f\u5199\u533a\u5206 Win [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"zakra_page_container_layout":"customizer","zakra_page_sidebar_layout":"customizer","zakra_remove_content_margin":false,"zakra_sidebar":"customizer","zakra_transparent_header":"customizer","zakra_logo":0,"zakra_main_header_style":"default","zakra_menu_item_color":"","zakra_menu_item_hover_color":"","zakra_menu_item_active_color":"","zakra_menu_active_style":"","zakra_page_header":true,"_lmt_disableupdate":"no","_lmt_disable":"no","footnotes":""},"categories":[1,615],"tags":[],"class_list":["post-8839","post","type-post","status-publish","format-standard","hentry","category-all","category-powershell"],"modified_by":"IYATT-yx","_links":{"self":[{"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/posts\/8839","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8839"}],"version-history":[{"count":1,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/posts\/8839\/revisions"}],"predecessor-version":[{"id":20368,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/posts\/8839\/revisions\/20368"}],"wp:attachment":[{"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8839"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8839"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8839"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}