PowerShellでクリップボードを使う。
System.Windows.Forms.TextBoxを使います。
PowerShellからクリップボードにテキストを送る。
[void][Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$textbox = new-object System.Windows.Forms.TextBox
$textbox.Multiline = $true
$textbox.Text = "あいうえお"
$textbox.SelectAll()
$textbox.Copy()
ここで、
$textbox.Text = [string]::join("`r`n", $args)
に変えて、PS1ファイルにファイルをドロップすれば、
ドロップしたファイルのパス名のリストをクリップボードに送ります。
クリップボードからテキストを取り出す。
[void][Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$textbox = new-object System.Windows.Forms.TextBox
$textbox.Multiline = $true
$textbox.Paste()
write-output $textbox.Text
« Doskeyのコマンド履歴にコマンドラインを事前設定する(その2) | トップページ | クリップボードをクリアする。 »