Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FolderExists("C:\test3\")) Then
WScript.Echo "あるよん"
Else
WScript.Echo "ないよん"
End If
■ 「c:\test3\」フォルダ内の「TechEzo.txt」が存在しているかチェックする
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FileExists("C:\test3\TechEzo.txt")) Then
WScript.Echo "あるよん"
Else
WScript.Echo "ないよん"
End If
Set fso = CreateObject("Scripting.FileSystemObject")
Set src = fso.GetDrive("H:") ' CD-ROMドライブがHの場合
If src.IsReady Then
WScript.Echo "準備おっけー"
Else
WScript.Echo "入ってないよぉ"
End If
Set fso = CreateObject("Scripting.FileSystemObject")
Set tmpFile = fso.OpenFile("C:\TechEzo\Round23.txt")
Do Until tmpFile.AtEndOfStream
tmpLine = tmpFile.ReadLine
WScript.Echo tmpLine
Loop
Set fso = CreateObject("Scripting.FileSystemObject")
Set tmpFile = fso.CreateTextFile("C:\TechEzo\Round23.txt")
tmpFile.WriteLine("これからレジメ作成さっ、とほほ")
tmpFile.close
Set tmpFile = Nothing
Set fso = Nothing
Set fso = CreateObject("Scripting.FileSystemObject")
Set tmpFile = fso.GetFile("C:\TechEzo\Round23.txt")
Set f = tmpFile.OpenAsTextStream(8, -2)
f.Write("どんな講習にしようかな?")
f.close
Set f = Nothing
Set tmpFile = Nothing
Set fso = Nothing