const strCmd = "tree path0 | findstr /R /C:""^├─"" /C:""^└─"" /C:""^│ ├─"" /C:""^│ └─"" /C:""^ ├"" /C:""^ └""" dim strPath :strPath = inputbox ("取得対象パスを入力してください。") if strPath = "" then Wscript.Quit dim sCmd : sCmd = replace(strCmd, "path0",strPath) dim fso:set fso = createObject("Scripting.FileSystemObject") With CreateObject("WScript.Shell") With .Exec("clip") Call .StdIn.Write(sCmd) End With End With msgbox "2階層Treeコマンドをクリップボードに出力しました。コマンドプロンプトから実行してください。" & chr(10) & chr(10) & "<出力コマンド>" & chr(10) & sCmd