0

Im trying to read my file in vbs and put it in a variable, but I keep getting a error stating that my input is in past the end of the file, and I don't know why..

Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("holder.canz", ForReading)
strText = objTextFile.ReadAll
objTextFile.Close
WScript.Echo strText
a - -
  • 1
  • Try to use the complete path of the file. – Shrotter Mar 02 '22 at 22:43
  • I tried that first and I did ./holder.canz to – a - - Mar 03 '22 at 00:09
  • 2
    See [here](https://stackoverflow.com/a/70043076/15764378) for using a relative path. However, `input is past the end of the file` instead of `file not found` suggests a different problem. Try a different test file. Maybe there is something unusual about `holder.canz`. The file is probably empty. – LesFerch Mar 03 '22 at 02:17
  • 2
    @VBasic2008 This isn't a `file not found` issue. The problem is with the input file. It's either empty or appears empty to the file system object (maybe starts with a ctrl-z). The duplicate link should cover it. – LesFerch Mar 03 '22 at 02:35

0 Answers0