title: task scheduler in win 2008 won't run vbs script
body: <p>I have a batch file which call a vbs script as following:    </p>
  
  <pre><code>cd d:
      cd D:\Application\Pentasafe\HKPentasafe\DailyLog\Deployment Code
      cscript CommandProcessing.vbs
      del /s "D:\Application\Pentasafe\HKPentasafe\DailyLog\Command Usage by Command\Tempworkspace\*.txt"
  </code></pre>
  
  <p>This batch file call this vbs (commandprocessing) thenit will delete the file in tempworkspace</p>
  
  <pre><code>Const ForReading = 1
  Const ForWriting = 2
  
  Dim Source, Dest
  
  objStartFolder = "D:\Application\Pentasafe\HKPentasafe\DailyLog\Command Usage by Command\Tempworkspace"
  objDestFolder = "D:\Application\Pentasafe\HKPentasafe\DailyLog\Command Usage by Command\Scripted"
  
  Set objFSO = CreateObject("Scripting.FileSystemObject")
  
  Set objFolder = objFSO.GetFolder(objStartFolder)
  Set colFiles = objFolder.Files
  
  'Only one file expected.
  For Each objFile in colFiles
      Source = ObjStartFolder + "\" + objFile.Name
      Dest = ObjDestFolder + "\" + objFile.Name
      wscript.echo Source
      wscript.echo Dest
  Next
  
  Set objFile = objFSO.OpenTextFile(Source, ForReading)
  
  Set objFile1 = objFSO.CreateTextFile(Dest, ForWriting)
  
  Do Until objFile.AtEndOfStream
      Strline = objFile.ReadLine
      'wscript.echo Strline
  
      If InStr(Strline,"CHGUSRPRF") Then
      Prependtext = "CHGUSRPRF"
      wscript.echo Strline
      objFile1.WriteLine Strline
      ElseIf InStr(Strline,"STRSQL") Then
      Prependtext = "STRSQL"
      wscript.echo Strline
      objFile1.WriteLine Strline
      ElseIf InStr(Strline,"STRDFU") Then
      Prependtext = "STRDFU"
      wscript.echo Strline
      objFile1.WriteLine Strline
      ElseIf InStr(Strline,"UPDATA") Then
      Prependtext = "UPDATA"
      wscript.echo Strline
      objFile1.WriteLine Strline
      ElseIf InStr(Strline,"EZVIEW") Then
      Prependtext = "EZVIEW"
      wscript.echo Strline
      objFile1.WriteLine Strline
      ElseIf InStr(Strline,"WRKQRY") Then
      Prependtext = "WRKQRY"
      wscript.echo Strline
      objFile1.WriteLine Strline
      ElseIf InStr(Strline,"WRKUSRPRF") Then
      Prependtext = "WRKUSRPRF"
      wscript.echo Strline
      objFile1.WriteLine Strline
      ElseIf InStr(Strline, "             ") Then
      If (Prependtext &lt;&gt; "") Then
          objFile1.WriteLine Replace(Strline, "             ", Prependtext)
          wscript.echo Replace(Strline, "             ", Prependtext)
      else
          objFile1.WriteLine Strline   
      End If
      Else 
      Prependtext = ""
      objFile1.WriteLine Strline
      End If
  Loop
  
  objFile.Close
  objFile1.Close
  </code></pre>
  
  <p>however, when i schedule this job in window server 2008.. it always won't call the vbs script. rather it skip it then do the delete job. 
  I have try to run it manually by double click the batch file.. 
  it run well in window xp until we upgrade to window server 2008. Anyone has any idea on this topic?</p>