我正在做一个实验室,说明书要检查文件是否存在。它建议使用布尔值Not
来完成它。
这是我的代码,但无论我做什么,我都无法超越循环的结束。我一直收到错误消息,指出该文件不存在。
Const Read = 1, Write = 2, Append = 8, ASCII = 0
FileName = "C:\users\gryphon\IP_Addresses.csv"
ipAddrStr = ""
NewRoom = 106
Comp1_IP = "192.168.10.59"
Comp2_IP = "192.168.10.60"
Comp3_IP = "192.168.10.61"
Comp4_IP = "192.168.10.61"
Set fso = CreateObject("Scripting.FileSystemObject")
ipAddrStr = CStr(NewRoom) & "1," & CStr(Comp1_IP) & CStr(NewRoom) & "2," & _
CStr(Comp2_IP) & CStr(NewRoom) & "3," & CStr(Comp3_IP) & _
CStr(NewRoom) & "4," & CStr(Comp4_IP)
If Not fso.FileExists("FileName") Then
WScript.StdOut.WriteLine(Chr(7) & Chr(7))
WScript.Echo "File Does Not Exist." & vbCrLf & _
"You Must Create the File Before You can Read the File."
WScript.Quit
End If
我做错了什么,我该如何解决?这必须由04DEC2016在太平洋标准时间晚上11点完成。我上周一请求我的导师帮忙,我还在等待回复。