title: execute bat with java program in task scheduler fail
body: <p>I have the following script, which works fine if executed manually, but does not work if set as a task in the task scheduler.</p>
  <p>I suspected a parameter may not be set correctly, but cannot spot it. Could someone please help me with that.</p>
  <pre class="lang-batch-file prettyprint-override"><code>@echo off
  setlocal EnableDelayedExpansion 
  
  cls
  
  set AllSections=
  Set Action=
  
  rem set PARMS=-Xms64M -Xmx512M -Dfile.encoding=UTF-8 -Dsikuli.FromCommandLine
  rem set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_202
  rem set SIKULIX_HOME=%~dp0
  
  set CurrentDate=%Date%
  set CurrentTime=%Time: =0%
  set CurrentTime=%CurrentTime:~0,8%
  set DateTimeStamp=%CurrentDate:~6,4%-%CurrentDate:~3,2%-%CurrentDate:~0,2%_%CurrentTime:~0,2%-%CurrentTime:~3,2%-%CurrentTime:~6,2%
  set FolderTimeStamp=%CurrentDate:~3,2%-%CurrentDate:~6,4%
  
  set DestinationFolder=SCADA\Output\%FolderTimeStamp%\%DateTimeStamp%
  
  md DestinationFolder=SCADA\Output &gt; nul 2&gt;&amp;1
  md DestinationFolder=SCADA\Output\%FolderTimeStamp% &gt; nul 2&gt;&amp;1
  md DestinationFolder=SCADA\Output\%FolderTimeStamp%\%DateTimeStamp% &gt; nul 2&gt;&amp;1
  md DestinationFolder=SCADA\Output\%FolderTimeStamp%\%DateTimeStamp%\Settings &gt; nul 2&gt;&amp;1
  md DestinationFolder=SCADA\Output\%FolderTimeStamp%\%DateTimeStamp%\Alarms &gt; nul 2&gt;&amp;1
  md DestinationFolder=SCADA\Output\%FolderTimeStamp%\%DateTimeStamp%\Network &gt; nul 2&gt;&amp;1
  
  
  rem Create Settings file
  
  
  rem echo &quot;Hello world&quot; &gt; %cd%\aa.txt
  
  rem \\\--below instructions working as script from command prompt , but not from task scheduler
  
  C:\sikulix\sikulixapi-2.0.5-win.jar -r C:\sikulix\Scada\Settings.sikuli
  C:\sikulix\sikulixapi-2.0.5-win.jar -r C:\sikulix\Scada\Alarms.sikuli
  C:\sikulix\sikulixapi-2.0.5-win.jar -r C:\sikulix\Scada\Networks.sikuli
  rem /////
  
  
  ENDLOCAL
  :End
  </code></pre>
  <p>I highlighted the bit that does not work; the folders are set correctly, but the java part fails to be executed in the task scheduler.</p>