バッチファイルで作るteeコマンド(その3)
PowerShellのone linerならバッチファイルに簡単に組み込めます。
unixのteeコマンドの分岐先はファイル出力ですが、標準エラー出力のほうが、汎用的です。
powershell -command "$input|foreach{[console]::out.writeline($_);[console]::error.writeline($_);}"
クリップボードに分岐するには、
PowerShell.exe -Sta -command "$input|tee-object -variable stdin;Add-Type -AssemblyName System.Windows.Forms;[Windows.Forms.Clipboard]::SetDataObject(($stdin|out-string),$true)"
« バッチファイルで作るteeコマンド(その2) | トップページ | 「名前を付けて画像を保存」でなく「対象をファイルに保存」する。 »