![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | write unicode?? for FSO I have a script I'm trying to use for starting NTBackup with different backup settings (*.bks file) each day. I need to write the bks file from my script before I call NTBackup. It appears the bks file is Unicode but when I write Unicode with objFSO.CreateTextFile(sFolderPathspec & "\Backup.bks", True, True).WriteLine "....." the file gets two extra bytes, FF FE, at the beginning of the file which seem to interfere with NTBackup reading that file. Does anyone know how I can write the file in the same format NTBackup does when saving its settings? thanks LJB |
My System Specs![]() |
| | #2 (permalink) |
| | Re: write unicode?? for FSO "LJB" <dustyb@xxxxxx> wrote in message news:GHd3l.11106$c45.9631@xxxxxx Quote: >I have a script I'm trying to use for starting NTBackup with different > backup settings (*.bks file) each day. I need to write the bks file from > my > script before I call NTBackup. It appears the bks file is Unicode but when > I > write Unicode with objFSO.CreateTextFile(sFolderPathspec & "\Backup.bks", > True, True).WriteLine "....." the file gets two extra bytes, FF FE, at the > beginning of the file which seem to interfere with NTBackup reading that > file. Does anyone know how I can write the file in the same format > NTBackup > does when saving its settings? > > thanks > LJB The following code snippet will read a binary file, then write the data to another binary file. All you need to do is precede sString with $FF$FE before writing the output file. Set oInputFile = oFSO.GetFile(sInputName) Set oOutputFile = oFSO.OpenTextFile(sOutputName, 2, True) Set oData = oInputFile.OpenAsTextStream sString = oData.Read(oInputFile.Size) oOutputFile.Write(sString) |
My System Specs![]() |
| | #3 (permalink) |
| | Re: write unicode?? for FSO "Pegasus (MVP)" <I.can@xxxxxx> wrote in message news:%23oIFST0YJHA.6108@xxxxxx Quote: > > "LJB" <dustyb@xxxxxx> wrote in message > news:GHd3l.11106$c45.9631@xxxxxx Quote: >>I have a script I'm trying to use for starting NTBackup with different >> backup settings (*.bks file) each day. I need to write the bks file from >> my >> script before I call NTBackup. It appears the bks file is Unicode but >> when I >> write Unicode with objFSO.CreateTextFile(sFolderPathspec & "\Backup.bks", >> True, True).WriteLine "....." the file gets two extra bytes, FF FE, at >> the >> beginning of the file which seem to interfere with NTBackup reading that >> file. Does anyone know how I can write the file in the same format >> NTBackup >> does when saving its settings? >> >> thanks >> LJB > Welcome to the world of ntbackup! > The following code snippet will read a binary file, then write the data to > another binary file. All you need to do is precede sString with $FF$FE > before writing the output file. > Set oInputFile = oFSO.GetFile(sInputName) > Set oOutputFile = oFSO.OpenTextFile(sOutputName, 2, True) > Set oData = oInputFile.OpenAsTextStream > sString = oData.Read(oInputFile.Size) > oOutputFile.Write(sString) > > Set oInputFile = objFSO.GetFile(sFolderPathspec & "\Backup.bks") Set oData = oInputFile.OpenAsTextStream sString = oData.Read(oInputFile.Size) Set oOutputFile = objFSO.OpenTextFile(sFolderPathspec & "\Backup.bks", 2, True) oOutputFile.Write(mid(sString,3)) thanks |
My System Specs![]() |
| | #4 (permalink) |
| | Re: write unicode?? for FSO "LJB" <xyz@xxxxxx> wrote in message news:XTu3l.10015$Ei5.6203@xxxxxx Quote: > > "Pegasus (MVP)" <I.can@xxxxxx> wrote in message > news:%23oIFST0YJHA.6108@xxxxxx Quote: >> >> "LJB" <dustyb@xxxxxx> wrote in message >> news:GHd3l.11106$c45.9631@xxxxxx Quote: >>>I have a script I'm trying to use for starting NTBackup with different >>> backup settings (*.bks file) each day. I need to write the bks file from >>> my >>> script before I call NTBackup. It appears the bks file is Unicode but >>> when I >>> write Unicode with objFSO.CreateTextFile(sFolderPathspec & >>> "\Backup.bks", >>> True, True).WriteLine "....." the file gets two extra bytes, FF FE, at >>> the >>> beginning of the file which seem to interfere with NTBackup reading that >>> file. Does anyone know how I can write the file in the same format >>> NTBackup >>> does when saving its settings? >>> >>> thanks >>> LJB >> Welcome to the world of ntbackup! >> The following code snippet will read a binary file, then write the data >> to another binary file. All you need to do is precede sString with $FF$FE >> before writing the output file. >> Set oInputFile = oFSO.GetFile(sInputName) >> Set oOutputFile = oFSO.OpenTextFile(sOutputName, 2, True) >> Set oData = oInputFile.OpenAsTextStream >> sString = oData.Read(oInputFile.Size) >> oOutputFile.Write(sString) >> >> > > Set oInputFile = objFSO.GetFile(sFolderPathspec & "\Backup.bks") > Set oData = oInputFile.OpenAsTextStream > sString = oData.Read(oInputFile.Size) > Set oOutputFile = objFSO.OpenTextFile(sFolderPathspec & "\Backup.bks", 2, > True) > oOutputFile.Write(mid(sString,3)) > > thanks |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| how to get powershell to write to event log or write a log file? | PowerShell | |||
| Write-Error doesn't write anyting | PowerShell | |||
| The disk is write-protected. Remove the write-protection or... | Vista General | |||
| newline in Write-Debug or Write-Verbose | PowerShell | |||
| New Message - Unicode (UTF-8) | Vista mail | |||