跳转到内容

PowerShell

维基百科,自由的百科全书

这是本页的一个历史版本,由P1ayer留言 | 贡献2008年5月27日 (二) 10:43 (外部連結, 先不找了, 要補上的人請便; 範例有幾個不知道該怎麼寫說明, 看得懂得人請自便; 其他請參考英文維基的本條目)编辑。这可能和当前版本存在着巨大的差异。

(差异) ←上一修订 | 最后版本 (差异) | 下一修订→ (差异)

Windows PowerShell是Windows最新一代的命令列介面

範例

  • 停止所有目前執行中的以"p"字元開頭命名的程式:
 PS> get-process p* | stop-process
  • 停止所有目前執行中的所有使用大於1000MB記憶體的程式:
 PS> get-process | where { $_.WS -gt 1000MB } | stop-process
  • Calculate the number of bytes in the files in a directory:
 PS> get-childitem | measure-object -property length -sum
  • 等待一個叫做"notepad"的程式執行結束:
 PS> $processToWatch = get-process notepad
 PS> $processToWatch.WaitForExit()
  • 將"hello, world!"字串轉為英文大寫字元,成為"HELLO, WORLD!":
 PS> "hello, world!".ToUpper()
  • 在字串"string"的第1個字元後插入字串"ABC",成為"sABCtring":
 PS> "string".Insert(1, "ABC")
  • Download a specific RSS feed and show the titles of the 8 most recent entries:
 PS> $rssUrl = "http://blogs.msdn.com/powershell/rss.aspx"
 PS> $blog = [xml](new-object System.Net.WebClient).DownloadString($rssUrl)
 PS> $blog.rss.channel.item | select title -first 8
  • Sets $UserProfile to the value of the UserProfile environment variable
 PS> $UserProfile = $env:UserProfile

支援應用程式

Application Version Cmdlets Provider Management GUI
Exchange Server 2007 402
Windows Server 2008
Microsoft SQL Server 2008
System Center Operations Manager 2007 74
System Center Virtual Machine Manager 2007
System Center Data Protection Manager 2007
Windows Compute Cluster Server 2007
Microsoft Transporter Suite for Lotus Domino[1] 08.02.0012 47
IBM WebSphere MQ[2] 6.0.2.2 44
Quest Management Shell for Active Directory[3] 1.0.5 29
Special Operations Software Specops Command[4] 1.0
VMware Infrastructure Toolkit[5] 1.0 Beta 102
Internet Information Services[6] 7.0 CTP
Ensim Unify Enterprise Edition[7] 1.6

外部連結

  1. ^ Microsoft Transporter Suite for Lotus Domino. [2008-03-07]. 
  2. ^ MO74: WebSphere MQ - Windows Powershell Library. [2007-12-05]. 
  3. ^ PowerShell Commands for Active Directory Quest Software. [2007-12-05]. 
  4. ^ PowerShell Remoting through Group Policy. [2007-12-07]. 
  5. ^ VMware Infrastructure Toolkit for Windows Beta. [2008-03-29]. 
  6. ^ IIS 7.0 PowerShell Provider Tech Preview 1. [2008-04-15]. 
  7. ^ Exchange Manager for 2003 and 2007. [2008-04-23].