- $s = @'
- $p12 = 'abc';
- $pro=New-Object System.Diag.Pr;
- $pro.Start = $false;
- $pro.Start.Red = $true; $s="hello"; $s1="world"; $s2="china"
- for ($x = 1; $x -lt 10; $x = $x + 1)
- {
- echo $x
- $s="word"
- }
- $arr = "Red", "Orange", "Green", "White", "Blue", "Indigo", "black", "Violet"
- for ($ii = 0; $ii -lt $arr.Length; $ii++)
- {
- $arr[$ii]
- }
- '@
- $reg=[regex]"\$[a-zA-Z0-9_]+"
- $reg.Matches($s)|select -Unique |?{$_.Value -ne '$false' -and $_.Value -ne '$true'}|%{$_.Value}
复制代码
|