title: VB Scripting error.. Object Required
body: <p>This is my first day with VB scripting. I found following code to search and replace text in a text file  but when I run that using the following command </p>
  
  <p><code>cscript replace.vbs "test.txt" "Jim" "James"</code></p>
  
  <p>I get an error saying</p>
  
  <p><code>replace.vbs(6, 1) Microsoft VBScript runtime error: Object required: 'Scripting'</code></p>
  
  <p>Here is the code</p>
  
  <pre><code>Const ForReading = 1    
  Const ForWriting = 2
  strFileName = Wscript.Arguments(0)
  strOldText = Wscript.Arguments(1)
  strNewText = Wscript.Arguments(2)
  Set objFSO = CreateObject(Scripting.FileSystemObject)
  Set objFile = objFSO.OpenTextFile(strFileName, ForReading)
  strText = objFile.ReadAll
  objFile.Close
  strNewText = Replace(strText, strOldText, strNewText)
  Set objFile = objFSO.OpenTextFile(strFileName, ForWriting)
  objFile.Write strNewText  'WriteLine adds extra CRLF
  objFile.Close
  </code></pre>