qshinoの日記

Powershell関係と徒然なこと

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

SynchronizingObject

SynchronizingObject on powetshell Start-ProcessのExitedイベントの終了処理で、wpfのLabel.Contentを変更したい。 それだけ。 $proc = Start-Process "poi.bat" -passThru $ev = Register-ObjectEvent $proc -EventName Exited -Action { AddText("hoge")…

teraterm log auto close

teraterm log auto close logautoclosemode 1 logopen 'D:\teraterm_sample.log' 0 0 ; do something... end ``` # 参考 https://ttssh2.osdn.jp/manual/ja/macro/command/logautoclosemode.html

git 作業ディレクトリの変更を戻す

git

作業ディレクトリの変更を戻す by git 作業したが変更を戻したい。 git checkout . これでカレント作業ディレクトリの変更を戻してくれるが、新規に作成したファイルは削除してくれず、手作業で削除する。なお、飽くまで作業ディレクトリの内容なので親ディ…

RunSpace

RunSpace 参考 https://msdn.microsoft.com/ja-jp/library/system.management.automation.runspaces.runspace(v=vs.85).aspx https://blogs.technet.microsoft.com/heyscriptingguy/2015/11/26/beginning-use-of-powershell-runspaces-part-1/ https://www.g…

WPF Clipboard

Clipboad on wpf by powershell PowerShellでWPFのクリップボードを使う。 [Windows.Clipboard] のGetText(), SetText()を使う。 $get = [Windows.Clipboard]::GetText() [Windows.Clipboard]::SetText("oha") [Windows.Clipboard]::Clear() 但し、下記が必…

.Netで作るPowerShellコンソール

Poweshellコンソール by wpf まさに欲しかったもの。PowerShellコンソールをWPFに組み込む。 肝はPowershll.Create()でPowershell を生成する事。 using (var powershell = PowerShell.Create()) { powershell.AddCommand("Get-ChildItem"); powershell.AddC…

Exited Event非同期対応

Start-ProcessのExitedEvent Thread Strart-ProcessのExited EventはデフォルトではSystem thread pool から実行される。UI系とは異なるため、UI系を制御すると問題が発生しやすい。 そのため、Formなどで使用するためにSynchronizingObject にUIオブジェク…

リモートデスクトップ via https/443

リモートデスクトップをHttpsで/ssl飛ばす。 myrtilleで可能な模様。WebSocketを使用している模様。 参考 https://github.com/cedrozor/myrtille/blob/master/README.md