0
0

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.

文字コードを指定してファイルを読む

Last updated at Posted at 2019-11-23

#文字コードを指定してファイルを読む

###VBSでUTF-8のファイルを読み込む方法

hoge.vbs
' ファイルストリームを生成
Dim iStream
Set iStream = CreateObject("ADODB.Stream")

'パラメタ 1:バイナリ 2:テキスト
iStream.type = 2

'入力ファイルの文字コードを設定
iStream.Charset = "UTF-8"
iStream.Open
iStream.LoadFromFile(ファイルパス)

Do While iStream.EOS = False
    ' 1行ずつ読み込んで処理する
Loop

'ストリームを閉じる
iStream.Close

'オブジェクトを解放 
Set iStream = Nothing
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?