{"id":254552,"date":"2015-04-06T07:09:02","date_gmt":"2015-04-06T03:09:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=254552"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=254552","title":{"rendered":"Bashrunner \u0438\u043b\u0438 PowerShell \u0434\u043b\u044f \u044e\u043d\u0438\u043a\u0441\u043e\u0438\u0434\u0430"},"content":{"rendered":"<p>     \t\u041a\u0430\u043a\u043e\u0439 \u0441\u043c\u044b\u0441\u043b \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0442\u044c \u0441\u0435\u0431\u044f \u0447\u0435\u043c-\u0442\u043e \u043e\u0434\u043d\u0438\u043c, \u0435\u0441\u043b\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0435\u043f\u043e\u0441\u0438\u043b\u044c\u043d\u043e\u0439 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0447\u0435\u0433\u043e-\u0442\u043e? \u041a\u0443\u0434\u0440\u044f\u0432\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e, \u0430 \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0449\u0435, \u0442\u043e \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u0430\u044f \u0448\u0442\u0443\u043a\u0430, \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0440\u0443\u0433\u043e\u0437\u043e\u0440. \u0418 \u043f\u043e\u0442\u043e\u043c, \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0432\u0435\u0449\u0438 \u043f\u0440\u043e\u0449\u0435 \u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u044c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445, \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0432 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u0441 \u0447\u0435\u043c-\u0442\u043e. \u041d\u043e \u0432\u0441\u0435 \u0436\u0435 \u043b\u0443\u0447\u0448\u0438\u043c \u0441\u0442\u0430\u0440\u0442\u043e\u043c \u0432 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0438 \u0447\u0435\u0433\u043e-\u043b\u0438\u0431\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0442\u0435\u043d\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0438 \u043e\u043f\u044b\u0442 \u043f\u0440\u0435\u0434\u0448\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u0438\u043a\u043e\u0432, \u0438 \u0435\u0441\u043b\u0438 \u043f\u0435\u0440\u0432\u043e\u0435 \u0434\u0430\u0435\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u0435, \u0432\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0441\u0442\u0432\u0443\u0435\u0442 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044e \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u041f\u0440\u0438\u0447\u0438\u043d\u044b, \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c Bash&#8217;\u0438\u0441\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c PowerShell (\u0440\u043e\u0432\u043d\u043e \u043a\u0430\u043a \u0438 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442), \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0441\u0430\u043c\u044b\u043c\u0438 \u0440\u0430\u0437\u043d\u044b\u043c\u0438, \u043d\u043e \u0432\u0441\u0435 \u0438\u0445 \u043c\u044b \u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0437\u0430 \u043a\u0430\u0434\u0440\u043e\u043c. \u041a\u0443\u0434\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0435\u0441 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0442\u043e, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0441\u0432\u043e\u0438\u0442\u044c PowerShell \u044e\u043d\u0438\u043a\u0441\u043e\u0438\u0434\u0443. \u041f\u043e\u0436\u0430\u043b\u0443\u0439, \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u0430\u0447\u043d\u044b\u043c \u0431\u044b\u043b\u043e \u0431\u044b \u0442\u0430\u043a\u043e\u0435 \u043d\u0430\u0447\u0430\u043b\u043e:<\/p>\n<pre><code class=\"perl\">PS C:\\&gt; man man  \u0418\u041c\u042f     Get-Help  \u041e\u041f\u0418\u0421\u0410\u041d\u0418\u0415     \u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u0445 \u0438 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044f\u0445 Windows PowerShell.  ...  PS C:\\&gt; <\/code><\/pre>\n<p>  \u041f\u043e\u043c\u0438\u043c\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e man \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 PowerShell \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u043f\u0441\u0435\u0432\u0434\u043e\u043d\u0438\u043c\u043e\u043c (\u0430\u043b\u044c\u044f\u0441\u043e\u043c) \u043a\u043e\u043c\u0430\u043d\u0434\u043b\u0435\u0442\u0430 Get-Help, \u044f\u0437\u044b\u043a\u043e\u043c \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0441\u043f\u0440\u0430\u0432\u043e\u0447\u043d\u043e\u0433\u043e \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f xml, \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u0432 Bash \u2014 \u044d\u0442\u043e troff, \u0438\u043c\u0435\u044e\u0449\u0438\u0439 \u0434\u043e\u043b\u0433\u0443\u044e \u0438 \u0443\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0438\u0441\u0442\u043e\u0440\u0438\u044e, \u043f\u0440\u0435\u0434\u0448\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e UNIX. \u0421\u0445\u043e\u0434\u0441\u0442\u0432\u043e \u0440\u0430\u0431\u043e\u0442\u044b man \u0432 Bash \u0438 PowerShell \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043d\u0430\u0439\u0434\u0435\u043d\u0430 \u043d\u0443\u0436\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430. \u0414\u0430\u043b\u0435\u0435, \u0432 Bash, \u043d\u0443\u0436\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0430 \u0435\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b, \u0438\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u0437\u0430\u043f\u0438\u0441\u044c:<\/p>\n<pre><code class=\"bash\">$ man proc <\/code><\/pre>\n<p>  \u0431\u0443\u0434\u0435\u0442 \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u0430:<\/p>\n<pre><code class=\"bash\">$ gzip -dc \/usr\/share\/man\/man5\/proc.5.gz | groff -man -Tascii | less <\/code><\/pre>\n<p>  \u0412 PowerShell \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0441\u043f\u0440\u0430\u0432\u043a\u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u043f\u043e\u0441\u043b\u0435 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0434\u0438\u0441\u043a\u0430. \u0412\u043f\u0440\u043e\u0447\u0435\u043c, \u044d\u0442\u0438 \u0438 \u043c\u043d\u043e\u0433\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u043d\u044e\u0430\u043d\u0441\u044b \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b \u043f\u043e \u043c\u0435\u0440\u0435 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u043a\u0430\u043a \u0441\u0430\u043c\u043e\u0439 \u0441\u043f\u0440\u0430\u0432\u043a\u0438, \u0442\u0430\u043a \u0438 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u043e\u0432 \u0437\u0430\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0432 PowerShell.<\/p>\n<p>  \u041d\u0430\u0440\u044f\u0434\u0443 \u0441 man, \u0432 PowerShell \u0435\u0441\u0442\u044c \u0437\u043d\u0430\u043a\u043e\u043c\u044b\u0435 \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u044e\u043d\u0438\u043a\u0441\u043e\u0438\u0434\u0443 ls, cat, echo, history \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0432\u044b\u0432\u043e\u0434 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0440\u043e\u0434\u0438\u043a\u0442\u043e\u0432\u0430\u043d\u044b \u043b\u0438\u0431\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u043b\u0438\u0431\u043e \u043b\u043e\u0433\u0438\u043a\u043e\u0439 \u0441\u0430\u043c\u043e\u0433\u043e \u0445\u043e\u0441\u0442\u0430 PowerShell. \u041d\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u044e\u043d\u0438\u043a\u0441\u043e\u0438\u0434\u043e\u0432 PowerShell \u043e\u0442\u043f\u0443\u0433\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0432\u0435\u0449\u0438 \u043a\u0430\u0436\u0443\u0442\u0441\u044f \u043d\u0435\u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u043c\u0438 \u0438\u043b\u0438 \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u044b\u043c\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"bash\">$ head foo <\/code><\/pre>\n<p>  \u0432 PowerShell \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"perl\">PS C:\\&gt; cat foo | select -f 10 <\/code><\/pre>\n<p>  \u041d\u0438\u0447\u0442\u043e \u043d\u0435 \u043c\u0435\u0448\u0430\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c head \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e.<\/p>\n<pre><code class=\"perl\">PS C:\\&gt; sc function:head {param([String]$File, [Int32]$Number=10) cat $File | select -f $Number} PS C:\\&gt; head foo <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0436\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u0447\u0442\u043e \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u043e\u0435, \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0441\u043f\u0435\u0440\u0432\u0430 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u0442\u0430\u043a\u0438\u043c\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\u043c\u0438 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430:<\/p>\n<pre><code class=\"perl\">PS C:\\&gt; man about_function ...  PS C:\\&gt; <\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u0432\u0430\u043c \u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432 \u0432 \u0432\u0438\u0434\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432, \u2014 \u044d\u0442\u043e \u043b\u0438\u0448\u044c \u043a \u0441\u043b\u043e\u0432\u0443.<\/p>\n<p>  \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u0432\u043e\u0437\u0431\u0440\u0430\u043d\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0440\u0442\u044b \u044e\u043d\u0438\u043a\u0441\u043e\u0432\u044b\u0445 \u0443\u0442\u0438\u043b\u0438\u0442 \u043f\u043e\u0434 Windows, \u043d\u043e \u043a\u0430\u043a\u043e\u0439 \u0432 \u043d\u0438\u0445 \u0441\u043c\u044b\u0441\u043b, \u043a\u043e\u0433\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u043e\u0433\u043e\u0432 \u0441\u0430\u043c\u043e\u0441\u043e\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0443\u0433\u043b\u0443\u0431\u0438\u0432 \u0441\u0432\u043e\u0438 \u0437\u043d\u0430\u043d\u0438\u044f \u0432 \u0441\u0438\u0441\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0435, \u0430 \u0442\u0430\u043c \u0433\u043b\u044f\u0434\u0438\u0448\u044c \u0438 \u0432\u043e\u0432\u0441\u0435 \u0441\u0442\u0430\u043d\u0435\u0442 \u043f\u0440\u043e\u0449\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0435 \u0434\u043b\u044f PowerShell \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f? \u0418 \u0432\u0441\u0435 \u0436\u0435 \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0445 \u043f\u043e\u0440\u0430\u0445, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044f \u043d\u0435\u043a\u0438\u0435 \u0430\u043d\u0430\u043b\u043e\u0433\u0438, \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u043e\u0441\u0442\u0438, \u043d\u0435 \u0433\u043e\u0432\u043e\u0440\u044f \u0443\u0436\u0435 \u043e \u043c\u0430\u0441\u0442\u0435\u0440\u0441\u0442\u0432\u0435 \u043e\u0434\u043d\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u0438\u043a\u043e\u0432. \u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0430\u043d\u0430\u043b\u043e\u0433\u043e\u0432 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0438\u0436\u0435.<\/p>\n<p>  <b>tail<\/b>  <\/p>\n<pre><code class=\"perl\">PS C:\\&gt; cat foo | select -l 10 <\/code><\/pre>\n<p>  <b>tail -f<\/b>  <\/p>\n<pre><code class=\"perl\">PS C:\\&gt; cat foo -Wait <\/code><\/pre>\n<p>  <b>less<\/b>  <\/p>\n<pre><code class=\"perl\">PS C:\\&gt; cat foo | oh -Paging <\/code><\/pre>\n<p>  <b>cat -n<\/b>  <\/p>\n<pre><code class=\"perl\">PS C:\\&gt; cat foo | % {$i=0}{$i++;&quot;$i $_&quot;} <\/code><\/pre>\n<p>  <b>tr -d<\/b>  <\/p>\n<pre><code class=\"perl\">PS C:\\&gt; &quot;`&quot;test`&quot;&quot; -replace [Char]34, '' <\/code><\/pre>\n<p>  <b>grep<\/b>  <\/p>\n<pre><code class=\"perl\">PS C:\\&gt; Set-Alias grep Select-String PS C:\\&gt; cat foo | grep bar <\/code><\/pre>\n<p>\u0418\u043b\u0438:  <\/p>\n<pre><code class=\"perl\">PS C:\\&gt; cat foo | ? {$_ -match 'bar'} <\/code><\/pre>\n<p>  <b>sed<\/b>  <\/p>\n<pre><code class=\"perl\">PS C:\\&gt; cat foo | % {$_ -replace 'bar', 'foo'} <\/code><\/pre>\n<p>  <b>wc<\/b>  <\/p>\n<pre><code class=\"perl\">PS C:\\&gt; (cat foo | measure -Word).Words <\/code><\/pre>\n<p>  <b>wc -l<\/b>  <\/p>\n<pre><code class=\"perl\">PS C:\\&gt; (cat foo | measure).Count <\/code><\/pre>\n<p>  <b>top<\/b>  <\/p>\n<pre><code class=\"perl\">PS C:\\&gt; while(1){cls;ps;sleep -s 3} <\/code><\/pre>\n<p>  <b>which<\/b>  <\/p>\n<pre><code class=\"perl\">PS C:\\&gt; Set-Alias which Get-Command PS C:\\&gt; which man <\/code><\/pre>\n<p>  <b>whoami<\/b>  <\/p>\n<pre><code class=\"perl\">PS C:\\&gt; ('UserDomainName', 'UserName' | % {[Environment]::$_}) -join '\\' <\/code><\/pre>\n<p>  <b>time<\/b>  <\/p>\n<pre><code class=\"perl\">PS C:\\&gt; sc function:time {param($Command) Measure-Command {$Command}} PS C:\\&gt; time Get-Help <\/code><\/pre>\n<p>  <b>touch<\/b>  <\/p>\n<pre><code class=\"perl\">PS C:\\&gt; Out-File foo -Encoding ASCII <\/code><\/pre>\n<p>  <b>touch -a<\/b>  <\/p>\n<pre><code class=\"perl\">PS C:\\&gt; (gi foo).LastAccessTime = [DateTime]'12.31.2014 23:00:00' <\/code><\/pre>\n<p>  <b>touch -m<\/b>  <\/p>\n<pre><code class=\"perl\">PS C:\\&gt; (gi foo).LastWriteTime = [DateTime]'12.31.2014 23:00:00' <\/code><\/pre>\n<p>  <b>who<\/b>  <\/p>\n<pre><code class=\"perl\">PS C:\\&gt; gp 'HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList\\*' | &gt;&gt; % {(New-Object Security.Principal.SecurityIdentifier($_.PSChildName)).Translate( &gt;&gt; [Security.Principal.NTAccount]).Value} &gt;&gt; ... PS C:\\&gt; <\/code><\/pre>\n<p>  <b>whatis<\/b>  <\/p>\n<pre><code class=\"perl\">PS C:\\&gt; sc function:whatis {param($Command) (Get-Command $Command).FileVersionInfo.FileDescription} PS C:\\&gt; whatis netsh <\/code><\/pre>\n<p>  \u041c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c \u0432 \u0442\u0430\u043a\u043e\u043c \u043a\u043b\u044e\u0447\u0435 \u0435\u0449\u0435 \u0434\u043e\u043b\u0433\u043e, \u2014 \u0441\u0443\u0442\u044c, \u043f\u043e\u043b\u0430\u0433\u0430\u044e, \u044f\u0441\u043d\u0430. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0447\u0430\u0441\u0442\u043e, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0435\u0435 \u0432 \u043f\u0440\u043e\u0444\u0438\u043b\u044c (man about_Profiles) \u0438\u043b\u0438 \u0436\u0435 \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c (man about_Modules) \u0441 \u043a\u0430\u043a\u0438\u043c-\u043d\u0438\u0431\u0443\u0434\u044c \u0433\u043e\u0432\u043e\u0440\u044f\u0449\u0438\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c, \u0441\u043a\u0430\u0436\u0435\u043c, bash \u0438\u043b\u0438 unix, \u0438\u043b\u0438 cal, \u0435\u0441\u043b\u0438 \u043c\u043e\u0434\u0443\u043b\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u043e\u0434\u043d\u043e\u0438\u043c\u0435\u043d\u043d\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443.<\/p>\n<p>  <b>cal.psm1<\/b>  <\/p>\n<pre><code class=\"perl\">#requires -version 2.0 if (!(Test-Path alias:cal)) {Set-Alias cal Get-Calendar}  function Get-Calendar {   param(     [Parameter(Position=0)]     [Alias('m')]     [ValidateRange(1, 12)]     [Int32]$Month = (Get-Date -u %m),          [Parameter(Position=1)]     [ValidateRange(2000, 9999)]     [Int32]$Year = (Get-Date -u %Y),          [Parameter(Position=2)]     [Alias('mf')]     [Switch]$MondayFirstly   )      begin {     [Globalization.DateTimeFormatInfo]::CurrentInfo.ShortestDayNames | % {$arr = @()}{$arr += $_}     $cal = [Globalization.CultureInfo]::CurrentCulture.Calendar     $dow = [Int32]$cal.GetDayOfWeek([DateTime]([String]$Month + '.1.' + [String]$Year))          if ($MondayFirstly) {       $arr = $arr[1..$arr.Length] + $arr[0]       if (($doe = --$dow) -lt 0) { $dow = 6 }     }   }   process {     $loc = [Globalization.DateTimeFormatInfo]::CurrentInfo.MonthNames[$Month - 1] + ' ' + $Year     $loc = [String]((' ' * [Math]::Round((20 - $loc.Length) \/ 2)) + $loc)          if ($dow -ne 0) { for ($i = 0; $i -lt $dow; $i++) { $arr += (' ' * 2) } }     1..$cal.GetDaysInMonth($Year, $Month) | % {       if ($_.ToString().Length -eq 1) { $arr += ' ' + [String]$_ }       else { $arr += [String]$_ }     } #foreach   }   end {     Write-Host $loc -fo Magenta     for ($i = 0; $i -lt $arr.Length; $i += 6) {       Write-Host $arr[$i..($i + 6)]       $i++     }     ''   } }  Export-ModuleMember -Alias cal -Function Get-Calendar <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043c\u043e\u0434\u0443\u043b\u044f:<\/p>\n<pre><code class=\"perl\">PS C:\\&gt; Import-Module cal PS C:\\&gt; cal -mf      \u0410\u043f\u0440\u0435\u043b\u044c 2015 \u041f\u043d \u0412\u0442 \u0421\u0440 \u0427\u0442 \u041f\u0442 \u0421\u0431 \u0412\u0441        1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30  PS C:\\&gt; <\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u0442\u0430\u043a\u0438\u043c \u0432\u043e\u0442 \u043d\u0435\u0437\u0430\u0442\u0435\u0439\u043b\u0438\u0432\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c PowerShell \u0432 Bash, \u0430 \u0441\u0442\u043e\u0438\u0442 \u043b\u0438 \u043e\u043d\u043e \u0442\u043e\u0433\u043e \u2014 \u0434\u0435\u043b\u043e \u0441\u0443\u0433\u0443\u0431\u043e \u043b\u0438\u0447\u043d\u043e\u0435.     \t<\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/254963\/\"> http:\/\/habrahabr.ru\/post\/254963\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>     \t\u041a\u0430\u043a\u043e\u0439 \u0441\u043c\u044b\u0441\u043b \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0442\u044c \u0441\u0435\u0431\u044f \u0447\u0435\u043c-\u0442\u043e \u043e\u0434\u043d\u0438\u043c, \u0435\u0441\u043b\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0435\u043f\u043e\u0441\u0438\u043b\u044c\u043d\u043e\u0439 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0447\u0435\u0433\u043e-\u0442\u043e? \u041a\u0443\u0434\u0440\u044f\u0432\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e, \u0430 \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0449\u0435, \u0442\u043e \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u0430\u044f \u0448\u0442\u0443\u043a\u0430, \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0440\u0443\u0433\u043e\u0437\u043e\u0440. \u0418 \u043f\u043e\u0442\u043e\u043c, \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0432\u0435\u0449\u0438 \u043f\u0440\u043e\u0449\u0435 \u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u044c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445, \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0432 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u0441 \u0447\u0435\u043c-\u0442\u043e. \u041d\u043e \u0432\u0441\u0435 \u0436\u0435 \u043b\u0443\u0447\u0448\u0438\u043c \u0441\u0442\u0430\u0440\u0442\u043e\u043c \u0432 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0438 \u0447\u0435\u0433\u043e-\u043b\u0438\u0431\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0442\u0435\u043d\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0438 \u043e\u043f\u044b\u0442 \u043f\u0440\u0435\u0434\u0448\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u0438\u043a\u043e\u0432, \u0438 \u0435\u0441\u043b\u0438 \u043f\u0435\u0440\u0432\u043e\u0435 \u0434\u0430\u0435\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u0435, \u0432\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0441\u0442\u0432\u0443\u0435\u0442 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044e \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-254552","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/254552","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=254552"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/254552\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=254552"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=254552"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=254552"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}