Last active
October 13, 2015 07:27
-
-
Save azechi/89eebaef73b9ba8e497b to your computer and use it in GitHub Desktop.
PowerShell よく忘れる
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select-object @{ n = "propertyName"; e = { /* expression $_ */ } } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# utf-8 のBOMありなしをみたかった | |
$bytes = [System.IO.File]::ReadAllBytes("hoge.xml") | |
($bytes[0..10] | % { $_.ToString("x")}) -join ' ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$xml = New-Object System.Xml.XmlDocument | |
$xml.PreserveWhitespace = $true | |
$xml.Load($file) | |
$nsmgr = New-Object System.Xml.XmlNamespaceManager $xml.NameTable | |
$nsmgr.AddNamespace("x", "http://schemas.microsoft.com/.NetConfiguration/v2.0") | |
$xml.SelectSingleNode("(//appSettings | //x:appSettings)/@file", $nsmgr).Value = $new_value | |
$xml.Save($file) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function f | |
{ | |
param([Parameter(ValueFromPipeline=$true)]$p) | |
begin {} | |
process {} | |
enc {} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sqlcmd -S localhost\dev -d dbname -E -Q @" | |
set nocount on; | |
select 'a', 'b', 'c', 0 , 1, 2 | |
; | |
"@ -h -1 -s "," -W |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment