Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

batch that works in 2000 but not NT4 1

Status
Not open for further replies.

nuct

Programmer
Sep 5, 2001
103
Hi i've written this:

for /f "tokens=1-4 delims=/ " %%a in ("%date%") do set dude=%%d%%b%%c

md %dude%

which makes a directory based on todays date. It works on 2000, but annoyingly does not work on NT4 Server. Has anybody got any ideas what the problem might be.

Cheers,

Simon
 
Yes its a feature that windows nt backup doesn't have.
 
I'm not completely sure hat you mean, what has nt backup got to do with it? The only real problem I have is that it makes a directory called %dude% in NT instead of '10122004' or whatever.

Simon.
 
Right sorry dude it was to early in the morning for me ....

I have now created a batch file that seems to run ok. It creates a directory with todays date in it.

This is how it looks. You can change the output to suit your needs.
---------------------------------------
for /f "Tokens=1-4 Delims=/ " %%i in ('date /t') do set dt=%%i-%%j-%%k-%%l
REM not that is one long line
md %dt%
-----------------------------------------


 
thats perfect mate, just need to get rid of the day and hyphens, most appreciated.

Simon.
 
No problems sorry for my first stupid answer...there is something true about not to do any work before 11 am :)

Yeah I played around with a bit more and you only need to change it to this to only get the date
for /f "Tokens=1-4 Delims=/ " %%i in ('date /t') do set dt=%%j%%k%%l

Which hopefully is the right output for you.
 
sounds like a good theory to me.

Simon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top