Powershell snips


/ Published in: Windows PowerShell
Save to your folder(s)

Short Random lines of code mostly from Powershell.com


Copy this code and paste it in your HTML
  1. #Build SQLCMD line for all files in the directory.
  2.  
  3. dir tables|foreach{$a = $_.Name;"r: Tables\$a"}>201106_Deploy.sql
  4.  
  5. #Generate random passwords
  6. -join ([Char[]]'abcdefgABCDEFG0123456&%$' | Get-Random -count 20)
  7.  
  8. #Generate a range of letters base on the ascii code (e.g. A: B:...)
  9. 65..90 | Foreach-Object { "$([char]$_):" }
  10.  
  11. <#Reading Text Files Fast - returns String#>
  12.  
  13. $a = [System.IO.File]::ReadAllText("$path\wkspace.csv")
  14.  
  15. <#Reading Text Files fast - returns Array
  16. Measure-command returns time to execute metadata#>
  17.  
  18. measure-command{[System.IO.File]::ReadAllText("$path\wkspace.csv")}

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.