随笔分类 - Powershell
摘要:link:http://stackoverflow.com/questions/9053573/powershell-html-parsing-get-information-from-a-website希望能从一个网页里获取一些信息function Get-FlightStatus { pa...
阅读全文
摘要:今天遇到一个问题,如何在Select-String的Pattern参数里能使用双引号比如 Select-String -path . -pattern "Lines: 100% " 是不能工作的查看了文档https://technet.microsoft.com/en-us/library/hh84...
阅读全文
摘要:今天讨论的是如何在Powershell里实现一个简单的Template Engine的功能。假设模板文件的内容如下:template.tthello $namewelcome $company模板引擎的函数定义在Invoke-Template.ps1function Invoke-Template ...
阅读全文
摘要:$filedata = @'app.name=Test Appapp.version=1.2'@$filedata | set-content appdata.txt$AppProps = convertfrom-stringdata (get-content ./appdata.txt -Raw)...
阅读全文
摘要:Link:http://www.tagwith.com/question_322855_how-to-pass-parameters-in-powershell-invoke-restmethod-postExamples: Invoke-RestMethod -Uri http://localho...
阅读全文
摘要:如果你已经开始在日常的工作中大量使用PowerShell自动化重复工作。建议你使用3.0以上的版本。可以使用如下命令检测你的PS版本如需要安装PowerShell,可以参看https://technet.microsoft.com/en-us/library/hh847837.aspx
阅读全文
摘要:今天看到文章上说Win7自带了Powershell,所以就想到一个问题: 如何能得到其版本呢? 今天过Baidu一下,发现只要在PS的命令行环境下运行get-Host命令就可以了:
阅读全文
摘要:今天打算用Powershell实现对一个目录下的指定文件进行批量重命名。比方说把所有图片文件的前缀image都给去了。 dir –fil *.jpg -rec| foreach {$_.name.replace (“image ”,””)}
阅读全文
摘要:最近在学习Powershell,今天学习到用match命令作文字的匹配。比方说: type person.cs | where {$_–match ‘name’} 结果输出就会是把文件里所有的name输出到命令行上。 COOL! :)但我的问题来了,如何能区分大小写,比方说我想只输出Name而不包括name.这就要用到cmatch,意思就是Case sensit...
阅读全文

浙公网安备 33010602011771号