Computer Hope
Microsoft => Microsoft DOS => Topic started by: Fielding on August 28, 2017, 03:31:28 PM
-
Hello everyone.
I would like to open a folder with date variables inside.
How can I do that ?
Example I am trying
Y:\Folder\%yyyy%\%mm%.%yyyy%\
where yyyy is the year of the system (windows 8.1) and mm is the month
Y:\Folder\2017\08.2017
Best Regards
-
Here we go :
@echo off
Title Get DateTime with Wmic
for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a"
set "YYYY=%dt:~0,4%"
set "MM=%dt:~4,2%"
set "DD=%dt:~6,2%"
set "HH=%dt:~8,2%"
set "Min=%dt:~10,2%"
set "Sec=%dt:~12,2%"
Set "DateTimeVar=%YYYY%%MM%%DD%%HH%%Min%%Sec%"
echo YYYYMMDDHHMinSec = %DateTimeVar%
echo Y:\Folder\%yyyy%\%mm%.%yyyy%\
pause
-
Thanks a lot Hackoo
Best Regards