• Windows PowerShell每周提示(4):使用Windows PowerShell “Here-Strings”

 

1. 当把多行并且包括很多特殊符号的字符串赋给变量时,我们可以用here-string.

 

2. 可以用来当注释.此时可以不用赋值给变量。

 

  • Windows PowerShell每周提示(5):在通配符查寻中使用范围操作符

1. Get-ChildItem C:\"Scripts"a*  (*-任何字符)

2. Get-ChildItem C:\"Scripts"FileA?.txt (?- 单个字符)

3. 设置范围操作符

Get-ChildItem C:\"Scripts"[a-f]*  ""需要所有文件名以字母a-f开头的所有文件的列

Get-ChildItem C:"Scripts"[0-9]* ""需要所有文件名以字母0-9开头的所有文件的列

4. 指定值

Get-ChildItem c:"Scripts"[bdf]

  • Windows PowerShell每周提示(6):创建自定义表格

             1. $a=@{Expression={$_.Name};Label = "Process Name";width = 25}, `
                  @{Expression={$_.ID};Label = "Process ID";width =15},`
                  @{Expression = {$_.MainWindowTile};Label = "Window Title";width =40}
                  Get-Process |Format-Table $a

                 输出:

                   

               

       

 

 

posted on 2009-07-17 21:44  gracestoney  阅读(173)  评论(0编辑  收藏  举报