You are not logged in.

#1 04 Apr 2007 19:14

maphew
Member
Registered: 04 Apr 2007
Posts: 7
Website

addition to FOR ... tokens page

hi there,

A friend just showed me this handy use of tokens which I didn't know existed: sequential letter variables are automatically created for each item in the list:

for /f "tokens=1-4 delims=/ " %%a in ('date /t') do (
  set dow=%%a
  set mm=%%b
  set dd=%%c
  set yy=%%d
)
echo Named Day: %%a
echo Month:    %%b
echo Day:    %%c
echo Year:    %%d

This would be useful info to add to http://ss64.com/nt/for_cmd.html
though a better example needs to be created, as this one will give varying results depending on the local systems default date format setup.

cheers,

-matt

Offline

#2 04 Apr 2007 19:29

Simon Sheppard
Admin
Registered: 27 Aug 2005
Posts: 1,130
Website

Re: addition to FOR ... tokens page

See this page for a similar example

http://ss64.com/nt/syntax-getdate.html

Offline

Board footer

Powered by