A Sample To start powershell

我们需要起个头学习PowerShell 

Set-Location 'C:UsersjwangDesktopPDFTESTPDFsGet'

$lines=Get-Content -Encoding UTF8 FILE_COPY3.LOG
$strArray=@("TemplateName")
$nameArray=@("PDFName")
foreach($line in $lines)
{
    $index0=$line.IndexOf("strPdfName=")+"strPdfName=".Length
    $index=$line.IndexOf("strtmp=")
    $subline0=$line.Substring($index0,$index-1-$index0)
    $subline=$line.Substring($index+7)
    if($strArray -notcontains $subline)
    {
          $strArray += $subline
          $nameArray+= $subline0
    }
}
Love it, and you live without it
原文地址:https://www.cnblogs.com/tomclock/p/7687079.html