I’m trying to write some Chinese characters to a text file using
Set myFSO = CreateObject("Scripting.FileSystemObject")
Set outputFile = myFSO.OpenTextFile(getOutputName(Argument, getMsiFileName(Wscript.Arguments)), forWriting, True)
outputFile.WriteLine(s)
The variable s contains a Chinese character that I read from the other file. I echo s value and I can see the s correctly in the screen. However, for some reason the script stops running after outputFile.WriteLine(s) without returning any error message.
Am I missing something?
Maybe it’s got something to do with character encoding. Try directly specifying the Unicode format for the file in the last parameter of the
OpenTextFilemethod:Also, you need to close the file after writing to it:
If this doesn’t help, try error handling like AnthonyWJones suggested.