powerShell

  1. get-help *-*
  2. get-host   power主机信息
  3. $C=Get-Credential –Credential powershell;Enter-PSSession –ComputerName   192.168.1.200 –Credential $C
  4. "{0}.{1}" -f $env:COMPUTERNAME, $env:USERDNSDOMAIN
  5. Get-NetIPInterface 列出网卡索引号 。使用如下命令就可以配置指定网卡(索引号)的优先级值,即直接配置接口跃点数值 Set-NetIPInterface -InterfaceIndex 21 -InterfaceMetric 10
  6. 复制文件夹所有内容 copy a -recurse b
  7. 重命名文件夹中所有文件名称

    $a=Get-ChildItem -Force -Recurse
    foreach($b in $a)
    { $c=[System.IO.Path]::GetFileNameWithoutExtension($b.name)+"-"+(get-random -min 10000000) +[System.IO.Path]::GetExtension($b.name)
    Rename-Item $b -NewName $c -Force
    }

  8. 打印文件名称 Get-ChildItem| select-object Name

posted on 2016-09-03 11:07  木龙哥  阅读(211)  评论(0)    收藏  举报

导航