powershell

  1. http://technet.microsoft.com/zh-cn/scriptcenter/powershell.aspx
  2. $Host.Version
  3. 1..15 | % {Write-Host -ForegroundColor $_ "Hello"}
  4. Get-Process | Stop-Process -WhatIf
  5. Get-Process | Stop-Process -Confirm
  6. Get-EventLog -LogName application -Newest 1
  7. Get-Verb
  8. Get-Variable
  9. Get-Command
  10. Get-Help
  11. Update-Help
  12. Get-Help Get-Process -Examples
  13. Dir,Cls,Md,Rd,Ls,Get-Process,Get-Service,Get-EventLog,Get-Lost?,Get-Help
  14. cat,可以用文本文件作为输入参数
  15. Get-Process notepad | Stop-Process
  16. Get-History(h), r 23再次执行第23条历史指令
  17. 重定向:>,>>
  18. 读文件:Get-Content(gc,cat,type)
  19. 添加内容:Add-Content(ac)
  20. 删除文件:Remove-Item(del,erase)
  21. dir | where { $_.Mode -match '^d' }
  22. Get-ChildItem . | where { $_.LastWriteTime -gt [datetime]"3/3/2013" }
  23. New-Item Alias:myalias -Value gps
  24. New-Item function:myfunction -Value{Get-Process -name $input},  "svchost" | myfunction
  25. New-Item env:myenv -Value "myenv", Get-Item Env:\myenv
  26. New-Item variable:myvar -Value "myVar", Get-Item Variable:\myvar
  27. Variable:Clear-Variable,Get-Variable,New-Variable,Remove-Variable,Set-Variable
  28. Alias: Expor-Alias,Get-Alias,Import-Alias,New-Alias,Set-Alias
  29. Get-Command -Noun Variable,Get-Variable $ | Format-List
  30. Get-Command -Noun alias

posted on 2013-11-23 23:57  架构师师  阅读(255)  评论(3编辑  收藏  举报

导航