title: Variable substitution issue while passing event details to Scheduled Task
body: <p>Using the site: <a href="http://aymanstechblog.blogspot.com/2012/05/passing-event-details-as-arguments.html" rel="nofollow" title="Passing event details as arguments through a scheduled task to the action program">http://aymanstechblog.blogspot.com/2012/05/passing-event-details-as-arguments.html</a>, I was able to set up an event-based task, and pass arguments from the event's description field (in event's XML: Event/EventData/Data) to the scheduled task's command, as arguments (in task's exported XML: Actions/Exec/Arguments).</p>
  
  <p>Using the above link's examples, I set up an "XML variable" in the EventTrigger/ValueQueries section (which I named "EventInfo"), </p>
  
  <pre><code>&lt;Triggers&gt;
    &lt;EventTrigger&gt;
      &lt;Enabled&gt;true&lt;/Enabled&gt;
      &lt;Subscription&gt;&amp;lt;QueryList&amp;gt;&amp;lt;Query Id="0" Path="Application"&amp;gt;&amp;lt;Select Path="Application"&amp;gt;*[System[Provider[@Name='triggerTestEvent']]]&amp;lt;/Select&amp;gt;&amp;lt;/Query&amp;gt;&amp;lt;/QueryList&amp;gt;&lt;/Subscription&gt;
      &lt;ValueQueries&gt;
        &lt;Value name="EventInfo"&gt;Event/EventData/Data&lt;/Value&gt;
      &lt;/ValueQueries&gt;
    &lt;/EventTrigger&gt;
  &lt;/Triggers&gt;
  </code></pre>
  
  <p>and referenced it in the Actions/Exec/Arguments field of a scheduled task. </p>
  
  <pre><code>&lt;Actions Context="Author"&gt;
    &lt;Exec&gt;
      &lt;Command&gt;bin\triggerTestEvent.bat&lt;/Command&gt;
      &lt;Arguments&gt;$(EventInfo)&lt;/Arguments&gt;
      &lt;WorkingDirectory&gt;T:\Test&lt;/WorkingDirectory&gt;
    &lt;/Exec&gt;
  &lt;/Actions&gt;
  </code></pre>
  
  <p>Using the command-line utility <code>eventcreate</code>, I ran tests with sample data (none of which was a single character), and there was no issue; the scheduled task's command (a small batch file to simply write the args passed to a log file) showed everything was coming thru perfectly/as-expected. </p>
  
  <pre><code>eventcreate /L application /so triggerTestEvent /id 101 /t INFORMATION /d "TEST #1"
  </code></pre>
  
  <p>However, I've encountered an issue when the data in the event is a <strong>single character</strong>. </p>
  
  <pre><code>eventcreate /L application /so triggerTestEvent /id 101 /t INFORMATION /d "1"
  </code></pre>
  
  <p>When this case is run, the variable replacement doesn't occur, and the "XML variable" string, <code>$(EventInfo)</code>, is passed to the batch file, unchanged, and printed. I've tested with alphabetic vs. numeric vs. punctuation. Any single character causes the failure, but when the character is doubled, the value comes thru perfectly.</p>
  
  <p>I've googled to no avail. I'm trying to find out if the issue is with me, or is it an actual bug in Scheduler's parsing of the event's XML.</p>