Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBScript writing to file

Status
Not open for further replies.

w33mhz

MIS
May 22, 2007
529
US
Can someone please tell me why and how I can work around: When I write to a file it places a special character at the begining of the first line? Now you may be asking "What are you talking about ? I write to files all the time and I don't see an special characters." Well when you open a file in notepad you don't see it, when you go to a command prompt and do a type <filename> you don't see it but if you do an edit <filename> from command prompt there it is. I wouldn't normally care about it, this is the first time something like this has come up. What i am doing is in my script I am writing a list of commands to the file then running plink to execute the list of commands from the command file. If you want to look at my code I will be more than happy to post it.
 
Have you tried Opening/Creating the file as Unicode?

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Check the WSH documentation for the .CreateTextFile or .OpenTextFile depending on which you are using.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Well that seems to be a tough one, i did find some code someone posted that used another argument in the create text file function, but didn't seem to work and I haven't really found any documantation about doing it besides that obscure code I found.
 
Ok I figured it out, I can also create file with the fso_OpenTextFile(strfile,intMethod,True,intFormat), which the CreatetextFile does not accept the last argument. That seemed to work well thanks for the post.

Just fyi I used in my code:

' ASCII = 0, Unicode = -1, SystemDefault = -2
intFormat = -2
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top