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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Batch file interpretation needed :-) 1

Status
Not open for further replies.

sqlsadie108

Programmer
Feb 23, 2007
47
US
Hi, just trying to "quickly" figure out what this batch file is doing... I think it's putting a time stamp on some files, but I don't get the "FOR %%A IN (0 1 2 3 4 5 6 7 8 9)" part.

Thanks much

Code:
REM Use ERRTIME.EXE for a sorted date (or time) in MS-DOS 7.*
ERRTIME -y > NUL
FOR %%A IN (0 1 2 3 4 5 6 7 8 9) DO IF ERRORLEVEL %%A0 SET ERR10=%%A
...
 
FOR is a dos command which basically does a loop through the values in the array.

What is actually being processeed by the FOR command is this.
Code:
IF ERRORLEVEL 00 SET ERR10=0
IF ERRORLEVEL 10 SET ERR10=1
IF ERRORLEVEL 20 SET ERR10=2
IF ERRORLEVEL 30 SET ERR10=3
IF ERRORLEVEL 40 SET ERR10=4
IF ERRORLEVEL 50 SET ERR10=5
IF ERRORLEVEL 60 SET ERR10=6
IF ERRORLEVEL 70 SET ERR10=7
IF ERRORLEVEL 80 SET ERR10=8
IF ERRORLEVEL 90 SET ERR10=9

Denny
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / Microsoft Windows SharePoint Services 3.0: Configuration / Microsoft Office SharePoint Server 2007: Configuration)
MCITP Database Administrator (SQL 2005) / Database Developer (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
thanks mrdenny

as it turns out, it just works so i don't really need to be 100% clear on how it works right now
 
no problem.

Denny
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / Microsoft Windows SharePoint Services 3.0: Configuration / Microsoft Office SharePoint Server 2007: Configuration)
MCITP Database Administrator (SQL 2005) / Database Developer (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top