スキップしてメイン コンテンツに移動

投稿

ラベル(opentextfile)が付いた投稿を表示しています

wscript opentextfile readall

* http://vbs.crap.jp/content/io/io1.shtml   * 十分な説明がある。      Set  objFso  = WScript. CreateObject ( "Scripting.FileSystemObject" )          'C:\のtest.txtを読込          Set  objFile  = objFso. OpenTextFile ( "C:\test.txt" )          'ファイルの内容を全て変数に格納          strRet  = objFile.ReadAll          '結果表示         Wscript.Echo strRet          'ファイルをクローズ         objFile.Close * http://win-script.net/vbs-filesystemobject/readall/   * simple. 上の例が詳しいのでスキップしていい * http://officetanaka.net/excel/vba/filesystemobject/textstream07.htm   * withを利用して例がある      Set  FSO  =  CreateObject ( "Scripting.FileSystemObject" )      ''C:\Work\Sample.txtの全ての文字を読み込んで表示します      With  FSO. GetFile ( "C:\Work\Sample.txt" ).OpenAsTextStream          buf  = .ReadAll          MsgBox  buf         .Close      End   With