vbs如何读写二进制文件?

2025-03-13 16:12:42
推荐回答(2个)
回答1:

楼上废话太多。。。

set fso=createobject("scripting.filesystemobject")
p=replace(wscript.scriptfullname,wscript.scriptname,"")&"1.txt"
set txt=fso.opentextfile(p,1)
ra=txt.readall
txt.close
msgbox ra

回答2:

Const ForReading = 1, ForWriting = 2
path = StrReverse(Split(StrReverse(WScript.ScriptfullName), "\", 2)(1))
FileName = path & "\1.txt"
Set fso = CreateObject("Scripting.FileSystemObject")
Set theFile = fso.OpenTextFile(FileName, ForReading, False)
SS= theFile.ReadALL
theFile.Close
MSGBOX SS ,64,NOW