Category Archives: write lines using vbscript

Create Text file and write lines using VBScript

Following script will create sample.txt file in the location where this script is stored and 10.10..10.93 will be written to sample.txt file

Dim objWshShell, objFSO, sScriptDir
Set objWshShell = CreateObject(“WScript.Shell”)
Set objFSO = CreateObject(“Scripting.FileSystemObject”)

strSecFileName = sScriptDir & “\sample.txt”

Set objSecFile = objFSO.CreateTextFile(strSecFileName, True)

Set objFSO = Nothing
Set objWshShell = Nothing