qshinoの日記

Powershell関係と徒然なこと

2017-03-22から1日間の記事一覧

-whatif on powershell

-whatif powershell のコモンパラメータの一つ、-whatif は、いわゆるドライランのオプション。Remove-itemやCopy-Itemなどで実行せずに、実行確認をする。 さて、実装するには? -whatif実装 肝は、 if( $PSCmdlet.ShouldProcess( $target ) ){ -whatif時に…

文字コード on powershell

文字コード on powershell コード sjis XAML sjis out-file unicode get/set-content sjis $outputencoding us-ascii chcp 65001

WebClient

WebClient by PowerShell Webclient classを使ってダウンロード function download ( [String]$dir = "c:\wk\poi", [uri]$uri = "https://www.google.com/index.html") { $file = Split-Path $uri.AbsolutePath -Leaf $bs = New-Object System.Net.WebClient…