上一页 1 ··· 47 48 49 50 51 52 53 54 55 ··· 95 下一页
  2014年12月4日
摘要: 当脚本执行完成后,可以删除自身1 #删除脚本自身2 remove-item $MyInvocation.MyCommand.Path -force 阅读全文
posted @ 2014-12-04 11:02 momingliu11 阅读(437) 评论(0) 推荐(0)
摘要: 1 #分别取出当前脚本的父目录、文件名 2 $Currentpath1 = Split-Path -parent $MyInvocation.MyCommand.Definition 3 $Currentpath2 = Split-Path -leaf $MyInvocation.M... 阅读全文
posted @ 2014-12-04 11:00 momingliu11 阅读(561) 评论(0) 推荐(0)
  2014年11月25日
摘要: 该方法只支持Win7及其以上系统,不支持Windows 20031 $Schedule = New-Object -com "Schedule.Service"2 $Schedule.Connect() 3 $tasks = $Schedule.GetFolder("\").GetTasks(0)4... 阅读全文
posted @ 2014-11-25 14:50 momingliu11 阅读(403) 评论(0) 推荐(0)
  2014年11月20日
摘要: $b=$host.UI.RawUI.ReadKey() $b.VirtualKeyCode -eq "13" #回车键Code为13 阅读全文
posted @ 2014-11-20 13:07 momingliu11 阅读(1423) 评论(2) 推荐(0)
  2014年11月12日
摘要: $a="a1","a2","a3","a4","a5","a6","a7","a8","a9","a10","a11","a12"Sort中的Property 参数的值可以是新的计算属性。若要创建计算属性,使用哈希表,其实就是相当于新添加了一个Property进行排序:方法一:$a| sort @{... 阅读全文
posted @ 2014-11-12 10:07 momingliu11 阅读(408) 评论(0) 推荐(0)
  2014年11月11日
摘要: 收集计算机分区信息 1 $servers = gc D:\serverlist.txt 2 $result = $results = $null 3 $results = @() 4 foreach ($server in $servers) 5 { 6 If ($server -eq "10"... 阅读全文
posted @ 2014-11-11 11:53 momingliu11 阅读(405) 评论(0) 推荐(0)
  2014年11月10日
摘要: 将数组转换为字符串,然后输出到CSV 1 [array]$array = "abc","dee","riwo" 2 #将数组转换为字符串 3 $b=$array -join "`n" 4 5 $r=$null 6 $r = ""|select a,b 7 $r.a = "aa" 8 $r.b =... 阅读全文
posted @ 2014-11-10 15:27 momingliu11 阅读(396) 评论(0) 推荐(0)
  2014年11月7日
摘要: 直接用 -split,默认以空白分隔。-split $a用正则表达式中的 \s,-replace -split中都可以直接使用正则表达式,select-string也可以split 和 join 默认使用空格,replace 默认使用空$a -split '\s+'$a -replace ("\s+... 阅读全文
posted @ 2014-11-07 16:09 momingliu11 阅读(6114) 评论(0) 推荐(0)
摘要: 该脚本用来访问一个url,并取出相应结果(该脚本用来通过淘宝API实现判断一个IP所在地) 1 #定义要访问的URL 2 $url="http://ip.taobao.com/service/getIpInfo.php?ip=8.8.8.8" 3 4 #定义函数:等待页面打开 5 function... 阅读全文
posted @ 2014-11-07 12:06 momingliu11 阅读(345) 评论(0) 推荐(0)
  2014年11月4日
摘要: 批处理:%PROCESSOR_IDENTIFIER:~0,3%PowerShell:([Array](Get-WmiObject -Query "select AddressWidth from Win32_Processor"))[0].AddressWidthPowerShell3.0:[Sys... 阅读全文
posted @ 2014-11-04 15:38 momingliu11 阅读(439) 评论(0) 推荐(0)
上一页 1 ··· 47 48 49 50 51 52 53 54 55 ··· 95 下一页