Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 504 Vote(s) - 3.48 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to get mm-dd-yyyy in DOS batch file?

#1
In a batch file I need to get a file from a folder that has today's date.

The problem is I can't get the batch date command to return the proper format.

I have this:
echo %date:/=-%

But that always returns for example: Fri 06-20-2014

What's the proper call for just returning: 06-20-2014

Looked all over can't find.

Thanks!
Reply

#2
set "$date=%date:~4%"
set "$date=%$date:/=-%"
echo %$date%
Reply

#3
This works independent of regional date/time format:
```lang-bat
for /f %%I in ('wmic os get localdatetime ^|find "20"') do set dt=%%I
REM dt format is now YYYYMMDDhhmmss...
set dt=%dt:~4,2%-%dt:~6,2%-%dt:~0,4%
echo %dt%
```
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through