Guest User

Untitled

a guest
May 22nd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.76 KB | None | 0 0
  1. PS E:\Documents\temp> $a.GetType()
  2.  
  3. IsPublic IsSerial Name BaseType
  4. -------- -------- ---- --------
  5. True True Object[] System.Array
  6.  
  7. PS E:\Documents\temp> $a | % { Set-Content -Path "$_-AA" -Value ($_*10)}
  8. PS E:\Documents\temp> dir
  9.  
  10.  
  11. ディレクトリ: E:\Documents\temp
  12.  
  13.  
  14. Mode LastWriteTime Length Name
  15. ---- ------------- ------ ----
  16. -a---- 2018/05/17 23:54 4 1-AA
  17. -a---- 2018/05/17 23:54 4 2-AA
  18. -a---- 2018/05/17 23:54 4 3-AA
  19. -a---- 2018/05/17 23:54 4 4-AA
  20.  
  21. PS E:\Documents\temp> dir | Get-Content
  22. 10
  23. 20
  24. 30
  25. 40
  26. PS E:\Documents\temp> dir | % { Get-Content $_ | %{ $_ -replace "0","--AAA" } | Set-Content -Path "$_-BB" }
  27. PS E:\Documents\temp> dir
  28.  
  29.  
  30. ディレクトリ: E:\Documents\temp
  31.  
  32.  
  33. Mode LastWriteTime Length Name
  34. ---- ------------- ------ ----
  35. -a---- 2018/05/17 23:54 4 1-AA
  36. -a---- 2018/05/17 23:55 8 1-AA-BB
  37. -a---- 2018/05/17 23:54 4 2-AA
  38. -a---- 2018/05/17 23:55 8 2-AA-BB
  39. -a---- 2018/05/17 23:54 4 3-AA
  40. -a---- 2018/05/17 23:55 8 3-AA-BB
  41. -a---- 2018/05/17 23:54 4 4-AA
  42. -a---- 2018/05/17 23:55 8 4-AA-BB
  43.  
  44.  
  45. PS E:\Documents\temp> dir *BB* | Get-Content
  46. 1--AAA
  47. 2--AAA
  48. 3--AAA
  49. 4--AAA
  50. PS E:\Documents\temp>
  51.  
  52. PS E:\Documents\temp> dir *BB | % { Write-Host -NoNewline $_.Name; Write-Host -NoNewline " -> "; Get-Content $_}
  53. 1-AA-BB -> 1--AAA
  54. 2-AA-BB -> 2--AAA
  55. 3-AA-BB -> 3--AAA
  56. 4-AA-BB -> 4--AAA
Add Comment
Please, Sign In to add comment