4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【VBS】ファイル操作

Last updated at Posted at 2014-10-20

書き込み

Set objFileSys = CreateObject("Scripting.FileSystemObject")

'第二引数 2:上書きモード 8:追記モード
'第三引数 true:新ファイル作成 false:対象ファイルが必要
Set writeStream = objFileSys.OpenTextFile("ファイル名",2,True)

'1行づつ書き込み
writeStream.WriteLine "書き込む文字列です。"

writeStream.Close
Set writeStream = Nothing
Set objFileSys = Nothing

 読み込み

Set objFileSys = CreateObject("Scripting.FileSystemObject")

'第二引数 1:読み込みモード
'第三引数 true:新ファイル作成 false:対象ファイルが必要
Set readStream = objFileSys.OpenTextFile("ファイル名",1,false)

'1行づつ読み込み
echo readStream.ReadLine

ReadStream.Close
Set ReadStream= Nothing
Set objFileSys = Nothing


4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?