Re: Creating folder names
After I posted that I found this solution: MD
%date:~4,2%%date:~7,2%%date:~-2%
It's simple and works perfect.
but thanks anyway.
"Pegasus (MVP)" <I.can@fly.com.oz> wrote in message
news:%23omCwJt2IHA.4848@TK2MSFTNGP05.phx.gbl...
>
> "JohnB" <jbrigan@yahoo.com> wrote in message
> news:uwLCMzs2IHA.4920@TK2MSFTNGP05.phx.gbl...
>>I know this isn't the DOS newsgroup but, I also know there are people here
>>that can answer this.
>>
>> I need to create folder names based on the current date. The names need
>> to be in this format: DDMMYY
>> I've googled and found lots of examples, but none for that format.
>> Anyone know how do do that?
>>
>> Thanks
>
> DOS could never do this sort of thing but the Command Prompt
> under all Windows NT-based OSs can. The usual way is to
> rearrange the various elements of the %date% variable. Unfortunately
> this method often fails when used with different regional settings.
> The batch file below will always return the correct value in %MyDate%.
> 1. @echo off
> 2. echo>c:\TempVBS.vbs wscript.echo day(date()) * 10000 + month(date()) *
> 100 + right(year(date()),2)
> 3. for /F %%a in ('cscript //nologo c:\TempVBS.vbs') do set MyDate=%%a
> 4. echo Date=%MyDate%
>
>