I guess my attempt failed for two reasons:
My programming skills are limited to a few months of on the job coding-retraining before I dropped out, none of that is in VBscript or even in an OOP language and;
I'm a dummy :) }
=======================================================
My original goal was to open a text file (wincmd.ini), do a straight (=unconditional) search and replace on twice (lines 11 and 12), save the same file and close it. This should happen at Windows-startup. I tried to use DOS batch files, but no joy. This VBscript seems to work, but I'm still getting the following error for this code. Please could you advise where it is wrong? Line 9 is "strText = objFile.ReadAll".
error: Line 9 | Character 1 | Error: Input past end of file | Code: 800A003E | Source: Microsoft VBScript runtime error.
Const ForReading = 1
Const ForWriting = 2
Const FileIn = "C:\totalcmd852\wincmd.ini"
Const FileOut = "C:\totalcmd852\wincmd.ini" '<== Change to prevent overwrite of original file
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(FileIn, ForReading)
strText = objFile.ReadAll
objFile.Close
strNewText = Replace(strText, "D:\totalcmd852\aWin10.bar", "C:\totalcmd852\aWin7.bar")
strNewText = Replace(strText, "D:\", "C:\")
Set objFile = objFSO.OpenTextFile(FileOut, ForWriting)
objFile.WriteLine strNewText
objFile.Close
What I tried: I looked at other solutions here and elsewhere, so I did figure out this is clearly, the infamous ReadAll error. It's trying to read something which isn't there. But ...... the problem is, the wincmd.ini-file is TOO, there. Please refer me to other solutions, and feel free to tell me what obvious thing I missed, but really: NONE of them seemed applicable to me. Then again, I've got very, very, very limited coding experience.
EDIT: The suggested answer did not fit, because: For some reason, each time I boot up, the file question is reduced to zero length. This produced the error.