Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
foncesa
- Posts: 42
- Joined: 12 Sep 2013 00:09
#1
Post
by foncesa » 30 Sep 2013 12:37
Hi,
I need to create 3 empty text files on todays date the format is 011013A, 011013B, 011013C, its ddmmyy.
The below batch does create a empty file but i tried to change the format but failed to achive the results. Will some help me to create 3 text files in one time with this format ddmmyy+A,B,C.
Code: Select all
@echo off
set tdtd=none
for /F "tokens=2-4 delims=/ " %%i in ('date /t') do set tdtd=%%j%%i%%k
set tufn=%tdtd%%A.txt
type NUL>%tufn%
-
Endoro
- Posts: 244
- Joined: 27 Mar 2013 01:29
- Location: Bozen
#2
Post
by Endoro » 30 Sep 2013 13:23
try this:
Code: Select all
@echo off &setlocal
for /f "tokens=2delims==" %%a in ('wmic os get localdatetime /value') do set "mydate=%%a"
set "mydate=%mydate:~6,2%%mydate:~4,2%%mydate:~2,2%"
for %%a in (A,B,C) do type nul>%mydate%%%a.TXT
dir %mydate%?.TXT
This works for XP Pro or better.