Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention. Check out this how-to article for more information.
' Define needed constants Const ForReading = 1 Const ForWriting = 2 Const TriStateUseDefault = -2 ' Get input file name from command line parm, if 2 parms entered ' use second as new output file, else rewrite to input file If (WScript.Arguments.Count > 0) Then sInfile = WScript.Arguments(0) Else WScript.Echo "No filename specified." WScript.Quit End If If (WScript.Arguments.Count > 1) Then sOutfile = WScript.Arguments(1) Else sOutfile = sInfile End If ' Create file system object Set oFSO = CreateObject("Scripting.FileSystemObject") ' Read entire input file into a variable and close it Set oInfile = oFSO.OpenTextFile(sInfile, ForReading, False, TriStateUseDefault) sData = oInfile.ReadAll oInfile.Close Set oInfile = Nothing ' Replace commas (,) with pipes (|) sData = Replace(sData, ",", "|") ' Write file with any changes made Set oOutfile = oFSO.OpenTextFile(sOutfile, ForWriting, True) oOutfile.Write(sData) oOutfile.Close Set oOutfile = Nothing ' Cleanup and end Set oFSO = Nothing Wscript.Quit
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.