XCOPYして標準出力メッセージをMsgBoxで表示させる
システムのバックアップなどに是非。
source="c:\moo.dat" dist="d:\" Set objExec = WSHShell.Exec("xcopy "+ source + " "+ dist + " /y") ' 標準出力が終了するまでループ Do Until objExec.StdOut.AtEndOfStream ' 1行読み込み outmessage =outmessage + objExec.StdOut.ReadLine +vbcrlf Loop msgbox outmessage ,vbinformation,"バックアップが完了しました。"
参考:
運用 Windows管理者のためのWindows Script Host入門
第5回 WshShellオブジェクトの詳細(1)
3.プログラムの実行方法2―Execメソッド
http://www.atmarkit.co.jp/fwin2k/operation/wsh05/wsh05_03.html