title: WScript.Echo output command in cmd
body: <p>I need some assistance with outputting an error in CMD.</p>
  
  <p>We have a timesheet system that is failing to add holidays into the users time sheets, it's done via a script. here is the portion of the script in question.</p>
  
  <pre><code>    sql = "select h_user,h_date1,h_hrs,h_approved,hol_default from holidays,hol_type,logins_users where userid=h_user and h_type=hol_id and h_date1='" &amp; today &amp; "' order by h_type desc"
      'WScript.Echo Sql
  
      ar.Open Sql, cnn ', adOpenForwardOnly, adLockReadOnly, adCmdText
  
      If Not (ar.EOF And ar.BOF) Then  'found some holidays
          ar.movefirst()
          While Not ar.EOF
              count = count + 1
              user = ar.Fields("h_user").Value
              datestr = ar.Fields("h_date1").Value
              hours = ar.Fields("h_hrs").Value
              approved = ar.Fields("h_approved").Value
              defaulthours = ar.Fields("hol_default").Value
              If hours = 8 Then actualhours = defaulthours
              If hours = 4 Then actualhours = defaulthours / 2
              If hours = 0 Then actualhours = 0
  
              sqlstr = "select * from timesheets where ts_user=" &amp; user &amp; " and ts_hrs in(" &amp; hours &amp; "," &amp; defaulthours &amp;") and ts_date='" &amp; today &amp; "' and ts_job=20"
              ar1.Open sqlstr, cnn
              If Not (ar1.EOF And ar1.BOF) Then
                  'record exists
                  sqlstr = "update timesheets set ts_eduser=0,ts_eddate=now() where ts_user=" &amp; user &amp; " and ts_hrs=" &amp; actualhours &amp; " and ts_date='" &amp; today &amp; "' and ts_job=20"
              Else
                  'no record
                  sqlstr = "insert into timesheets (ts_user,ts_date,ts_hrs,ts_approved,ts_job,ts_cruser,ts_crdate) values (" &amp; user &amp; ",'" &amp; today &amp; "'," &amp; actualhours &amp; "," &amp; approved &amp; ",20,0,Now())"
              End If
              ar1.Close()
              cnn.Execute("insert into tracking (t_user,t_query) values (0,'" &amp; addslashes(sqlstr) &amp; "')")
              cnn.Execute(sqlstr)
              ar.MoveNext()
          Wend
      End If
      ar.Close
  Next
  message = message &amp; count &amp; " holidays entries added" &amp; vbCrLf
  count = 0
  
  Set ar1 = Nothing
  Set ar2 = Nothing
  Set ar1 = CreateObject("ADODB.RecordSet")
  Set ar2 = CreateObject("ADODB.RecordSet")
  
  For n = 0 To 28
      daystr = DateAdd("d", n, Now())
  
      today = Mid(daystr, 7, 4) &amp; "-" &amp; Mid(daystr, 4, 2) &amp; "-" &amp; Left(daystr, 2)
  </code></pre>
  
  <p>What I need to do is specifically output the results of defaulthours in a cmd window to allow me to inspect the error in the data it's retrieving.</p>
  
  <p>I realise it's a <code>WScript.Echo</code> command but I've tried several variations and it stops the script from running.</p>
  
  <p>Could someone point me in the right direction?</p>