FileExists签入WSH脚本,给出对象预期的错误

时间:2012-09-19 06:30:41

标签: wsh

为什么我收到运行时错误“Object expected” - If(fs.FileExists(filename))?

  var filename = "d:\\list.txt";

  fs = new ActiveXObject("Scripting.FileSystemObject");

  If (fs.FileExists(filename)) //i 'm getting a runtime error "Object expected" here
  {
    // Open the file 
  }

1 个答案:

答案 0 :(得分:3)

If更改为if。 JScript是一种区分大小写的语言。