Home > Software engineering >  VBS how to read no suffix text file always suggest it is more than end-of-file, how be to return a r
VBS how to read no suffix text file always suggest it is more than end-of-file, how be to return a r

Time:09-26

VBS how to read no suffix text file always suggest it is more than end-of-file, how be to return a responsibility? I am using:

The Set of fso=CreateObject (" Scripting. FileSystemObject ")
The Set f=fso. OpenTextFile (" C: \ Windows \ System32 \ drivers \ etc \ hosts ", ForReading)
ReadAllTextFile=f.R eadAll

CodePudding user response:

Is usually a permissions problem, want to run the VBS as an administrator,

CodePudding user response:

Closed the 360?

CodePudding user response:

I manually tested under
No problem
Can open, the estimate is permissions or firewall problems
 Const ForReading=1 
The Set objFSO=CreateObject (" Scripting. FileSystemObject ")
The Set objFile=objFSO. OpenTextFile (" C: \ Windows \ System32 \ drivers \ etc \ hosts ", ForReading)
StrContents=objFile. ReadAll
MSGBOX strContents
ObjFile. Close
  • Related