title: Batch file run cmd1 if time 10pm-4am else run cmd2
body: <p>I have a batch file and within that batch file I need to run one of two commands depending on time of my server.</p>
  <p>If the time is between 22:00:00 and 03:30:00 -- xcopy /Y a\1.txt c\1.txt</p>
  <p>If the time is before or after this range -- -- xcopy /Y b\1.txt c\1.txt</p>
  <p>This will use xcopy to switch a file back and forth depending on the time.</p>
  <p>I know this is easy but my brain just won't work atm lol</p>
  <p>Edit:</p>
  <p>Went with 22:00 and 4:00... this is what I came up with but it doesn't seem like the best way...</p>
  <pre><code>set current_time=%time:~0,5% 
  
  if &quot;%current_time%&quot; lss &quot;22:00&quot; goto daycycle 
  
  if &quot;%current_time%&quot; gtr &quot; 4:00&quot; goto daycycle 
  
  echo Do this between 10pm and 4am
  
  goto continue 
  
  :daycycle 
  
  echo Do this before 10pm and after 4am
  
  :continue
  </code></pre>