title: How to add time in 12-hours format to filename using Windows command line?
body: <p>I need to have filename with hours in 12-hours format - from 1 to 12 (with am or pm optional) like below:</p>
  
  <pre><code>myfile_2pm.txt
  </code></pre>
  
  <p>I wrote script but it works only for 24-hours format and crashes if it has "1-digit" hour because colon:</p>
  
  <pre><code>Hello &gt; myfile_%time:~-0,2%.txt
  </code></pre>