Skip to content

Instantly share code, notes, and snippets.

@azechi
Last active October 13, 2015 07:27
Show Gist options
  • Save azechi/89eebaef73b9ba8e497b to your computer and use it in GitHub Desktop.
Save azechi/89eebaef73b9ba8e497b to your computer and use it in GitHub Desktop.
PowerShell よく忘れる
select-object @{ n = "propertyName"; e = { /* expression $_ */ } }
# utf-8 のBOMありなしをみたかった
$bytes = [System.IO.File]::ReadAllBytes("hoge.xml")
($bytes[0..10] | % { $_.ToString("x")}) -join ' '
$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)
function f
{
param([Parameter(ValueFromPipeline=$true)]$p)
begin {}
process {}
enc {}
}
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