Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

substring of time in cmd variable

$
0
0

Windows Server 2003 R2, Enterprise Edition, sp 2

This should be simple enough:

E:\>time /t
09:34 AM

E:\>echo %time:~0,2%
 9

E:\>

Why is the substring of time replaceing the leading zero with a space?  This wreaks havoc in a command file in trying to use a timestamp as a component of a file name before 10:00 am.


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>