Click here to Skip to main content
15,903,523 members
Home / Discussions / System Admin
   

System Admin

 
GeneralRe: One more network question... Pin
Jerry Hammond28-Sep-07 16:21
Jerry Hammond28-Sep-07 16:21 
JokeRe: One more network question... Pin
Anton Afanasyev27-Sep-07 16:13
Anton Afanasyev27-Sep-07 16:13 
GeneralRe: One more network question... Pin
Jerry Hammond27-Sep-07 16:24
Jerry Hammond27-Sep-07 16:24 
GeneralRe: One more network question... Pin
PIEBALDconsult27-Sep-07 16:31
mvePIEBALDconsult27-Sep-07 16:31 
QuestionBatch file question Pin
Tad McClellan25-Sep-07 6:24
professionalTad McClellan25-Sep-07 6:24 
AnswerRe: Batch file question Pin
Vasudevan Deepak Kumar25-Sep-07 7:11
Vasudevan Deepak Kumar25-Sep-07 7:11 
GeneralRe: Batch file question Pin
Tad McClellan25-Sep-07 13:19
professionalTad McClellan25-Sep-07 13:19 
GeneralRe: Batch file question Pin
ESTAN26-Sep-07 2:28
ESTAN26-Sep-07 2:28 
Here is the accepted solution. Good luck.

Here's a batch file I developed to subtract any number of days from the current date. It accepts a command line parameter of the number of days. The default is 1 day (yesterday):

@echo off

set yyyy=

set $tok=1-3
for /f "tokens=1 delims=.:/-, " %%u in ('date /t') do set $d1=%%u
if "%$d1:~0,1%" GTR "9" set $tok=2-4
for /f "tokens=%$tok% delims=.:/-, " %%u in ('date /t') do (
 for /f "skip=1 tokens=2-4 delims=/-,()." %%x in ('echo.^|date') do (
    set %%x=%%u
    set %%y=%%v
    set %%z=%%w
    set $d1=
    set $tok=))

if "%yyyy%"=="" set yyyy=%yy%
if /I %yyyy% LSS 100 set /A yyyy=2000 + 1%yyyy% - 100

set CurDate=%mm%/%dd%/%yyyy%

set dayCnt=%1

if "%dayCnt%"=="" set dayCnt=1

REM Substract your days here
set /A dd=1%dd% - 100 - %dayCnt%
set /A mm=1%mm% - 100

:CHKDAY

if /I %dd% GTR 0 goto DONE

set /A mm=%mm% - 1

if /I %mm% GTR 0 goto ADJUSTDAY

set /A mm=12
set /A yyyy=%yyyy% - 1

:ADJUSTDAY

if %mm%==1 goto SET31
if %mm%==2 goto LEAPCHK
if %mm%==3 goto SET31
if %mm%==4 goto SET30
if %mm%==5 goto SET31
if %mm%==6 goto SET30
if %mm%==7 goto SET31
if %mm%==8 goto SET31
if %mm%==9 goto SET30
if %mm%==10 goto SET31
if %mm%==11 goto SET30
REM ** Month 12 falls through

:SET31

set /A dd=31 + %dd%

goto CHKDAY

:SET30

set /A dd=30 + %dd%

goto CHKDAY

:LEAPCHK

set /A tt=%yyyy% %% 4

if not %tt%==0 goto SET28

set /A tt=%yyyy% %% 100

if not %tt%==0 goto SET29

set /A tt=%yyyy% %% 400

if %tt%==0 goto SET29

:SET28

set /A dd=28 + %dd%

goto CHKDAY

:SET29

set /A dd=29 + %dd%

goto CHKDAY

:DONE

if /I %mm% LSS 10 set mm=0%mm%
if /I %dd% LSS 10 set dd=0%dd%

echo Date %dayCnt% day(s) before %CurDate% is %mm%/%dd%/%yyyy%

Good Luck,
Steve

QuestionVisual Studio 2005 and SQL Server 2005 on Vista Ultimate Pin
juniorjith25-Sep-07 5:30
juniorjith25-Sep-07 5:30 
AnswerRe: Visual Studio 2005 and SQL Server 2005 on Vista Ultimate Pin
Dave Kreskowiak25-Sep-07 7:07
mveDave Kreskowiak25-Sep-07 7:07 
GeneralRe: Visual Studio 2005 and SQL Server 2005 on Vista Ultimate Pin
juniorjith25-Sep-07 7:14
juniorjith25-Sep-07 7:14 
QuestionWindows Server 2003 for Small Business Server Issue Pin
Programm3r24-Sep-07 22:14
Programm3r24-Sep-07 22:14 
AnswerRe: Windows Server 2003 for Small Business Server Issue Pin
Jerry Hammond25-Sep-07 2:39
Jerry Hammond25-Sep-07 2:39 
QuestionRe: Windows Server 2003 for Small Business Server Issue Pin
Programm3r25-Sep-07 3:09
Programm3r25-Sep-07 3:09 
AnswerRe: Windows Server 2003 for Small Business Server Issue Pin
Hesbon Ongira26-Sep-07 1:35
Hesbon Ongira26-Sep-07 1:35 
GeneralRe: Windows Server 2003 for Small Business Server Issue Pin
Programm3r26-Sep-07 19:22
Programm3r26-Sep-07 19:22 
AnswerRe: Windows Server 2003 for Small Business Server Issue Pin
Jerry Hammond26-Sep-07 2:00
Jerry Hammond26-Sep-07 2:00 
GeneralRe: Windows Server 2003 for Small Business Server Issue Pin
Programm3r26-Sep-07 19:21
Programm3r26-Sep-07 19:21 
AnswerRe: ERROR Could not obtain requested lock Pin
Jerry Hammond24-Sep-07 16:14
Jerry Hammond24-Sep-07 16:14 
GeneralRe: ERROR Could not obtain requested lock Pin
Jerry Hammond25-Sep-07 2:43
Jerry Hammond25-Sep-07 2:43 
Questionexe addresses Pin
samira forooghi22-Sep-07 0:51
samira forooghi22-Sep-07 0:51 
AnswerRe: exe addresses Pin
Luc Pattyn22-Sep-07 1:32
sitebuilderLuc Pattyn22-Sep-07 1:32 
GeneralRe: exe addresses Pin
samira forooghi22-Sep-07 1:46
samira forooghi22-Sep-07 1:46 
GeneralRe: exe addresses Pin
Luc Pattyn22-Sep-07 3:19
sitebuilderLuc Pattyn22-Sep-07 3:19 
GeneralRe: exe addresses Pin
samira forooghi22-Sep-07 19:36
samira forooghi22-Sep-07 19:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.