Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Yesterday

15 views
Skip to first unread message

Frank-Peter Schultze

unread,
Jul 5, 2004, 5:30:56 PM7/5/04
to
For what it's worth, here a pure batch method that calculates yesterday's date...

:===
@echo off
echo. | date | %SystemRoot%\system32\find.exe /i "(mm" >NUL
if errorlevel 1 (call :Parsedate DD MM) else (call :Parsedate MM DD)
goto thismonth
:Parsedate
for /f "tokens=1-4 delims=/.- " %%A in (
'date /t'
) do (
if %%D!==! (
set %1=%%A
set %2=%%B
set YYYY=%%C
) else (
set %1=%%B
set %2=%%C
set YYYY=%%D)
goto :EOF)
:thismonth
if %DD%!==01! goto prevmonth
set /a D1 = %DD% - 1
set M1=%MM%
set YYY1=%YYYY%
goto end
:prevmonth
if %MM%!==01! goto prevyear
if %MM%!==03! goto february
set /a parity = %MM% %% 2
if %parity%!==1! goto oddmonth
if %parity%!==0! goto parmonth
echo Error
goto end
:prevyear
set D1=31
set M1=12
set /a YYY1 = %YYYY% - 1
goto end
:february
set D1=28
set /a M1 = %MM% - 1
set YYY1=%YYYY%
set /a bisextile = %YYYY% %% 4
if %bisextile%!==0! set D1=29
goto end
:parmonth
set D1=30
set /a M1 = %MM% - 1
set YYY1=%YYYY%
goto end
:oddmonth
set D1=31
set /a M1 = %MM% - 1
set YYY1=%YYYY%
goto end
:end
if %D1% LEQ 9 set D1=0%D1%
if not %M1%==%MM% if %M1% LEQ 9 set M1=0%M1%
echo Yesterday = %YYY1%%M1%%D1%
:===

Kind regards
fps

--
Frank-Peter Schultze, http://www.fpschultze.de/

Timo Salmi

unread,
Jul 5, 2004, 11:38:16 PM7/5/04
to
Frank-Peter Schultze <ng-r...@fpschultze.de> wrote:
> For what it's worth, here a pure batch method that calculates yesterday's date...

Frank-Peter, it is excellent to have such solutions. You are,
naturally, aware of

6} How does one get yesterday's date?

97091 Jun 28 2004 ftp://garbo.uwasa.fi/pc/link/tscmd.zip
tscmd.zip Useful NT/2000/XP script tricks and tips, T.Salmi

I'll add your posting's Message-ID for reference.

All the best, Timo

--
Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance ; University of Vaasa
mailto:t...@uwasa.fi <http://www.uwasa.fi/~ts/> ; FIN-65101, Finland
Timo's FAQ materials at http://www.uwasa.fi/~ts/http/tsfaq.html

Todd Vargo

unread,
Jul 6, 2004, 12:36:30 AM7/6/04
to

"Timo Salmi" <t...@UWasa.Fi> wrote in message
news:ccd6r8$p...@poiju.uwasa.fi...

> Frank-Peter Schultze <ng-r...@fpschultze.de> wrote:
> > For what it's worth, here a pure batch method that calculates
yesterday's date...
>
> Frank-Peter, it is excellent to have such solutions.

IIRC, SET/A is not available in NT. ;-)

--
Todd Vargo (remove hyphen to reply by email)


Phil Robyn

unread,
Jul 6, 2004, 12:41:03 AM7/6/04
to
Todd Vargo wrote:

No, 'set /a' *is* available in NT4.0.

--
Phil Robyn
Univ. of California, Berkeley

u n z i p m y a d d r e s s t o s e n d e - m a i l

Todd Vargo

unread,
Jul 6, 2004, 12:58:30 AM7/6/04
to

"Todd Vargo" <todd_...@nccw.net> wrote in message
news:2kuog2F...@uni-berlin.de...

>
> "Timo Salmi" <t...@UWasa.Fi> wrote in message
> news:ccd6r8$p...@poiju.uwasa.fi...
> > Frank-Peter Schultze <ng-r...@fpschultze.de> wrote:
> > > For what it's worth, here a pure batch method that calculates
> yesterday's date...
> >
> > Frank-Peter, it is excellent to have such solutions.
>
> IIRC, SET/A is not available in NT. ;-)

BTW, the month parity is incorrect too. Only odd months before August have
31 days. August, October and December are even months, but also have 31
days. It is better to choose from a data table.

Garry Deane

unread,
Jul 6, 2004, 2:14:30 AM7/6/04
to
On 5 Jul 2004 14:30:56 -0700, ng-r...@fpschultze.de (Frank-Peter
Schultze) wrote:

>For what it's worth, here a pure batch method that calculates yesterday's date...
>

><snip>

Also for what it's worth, here's my version (NT or higher).

Garry

@echo off
setlocal
call :Get_Date yy mm dd
call :Dec_Date yy mm dd
echo Yesterday was %yy%-%mm%-%dd%
goto :eof

:: ------------------------------------------------------------------
:Get_Date yy mm dd
:: ------------------------------------------------------------------
setlocal
if "%date%A" LSS "A" (set toks=1-3) else (set toks=2-4)
for /f "tokens=2-4 delims=(-)" %%a in ('echo:^|date') do (
for /f "tokens=%toks% delims=.-/ " %%i in ('date/t') do (
set %%a=%%i
set %%b=%%j
set %%c=%%k))
if %yy% LSS 100 set yy=20%yy%
endlocal & (set %1=%yy%)&(set %2=%mm%)&(set %3=%dd%)
goto :eof

:: ------------------------------------------------------------------
:Dec_Date yy mm dd
:: ------------------------------------------------------------------
setlocal
:: Strip leading zeros from possible octals and decrement the day
call set /a yy=%1, mm=100%%%2%%%%%%100, dd=100%%%3%%%%%%100-1
if %dd% NEQ 0 goto :Dec_date_end
:: Today is the 1st of the month - decrement the month
:: and set leap year check (ignoring centuries)
set /a mm-=1,ly=yy%%4
:: If today is 1 Jan, set date to 31st Dec
if %mm% EQU 0 (set /a dd=31, mm=12, yy-=1) else (
rem Calculate days in last month (by Frank Westlake)
set /a "dd=5546>>mm&1,dd+=30"
rem Special case for February
if %mm% EQU 2 if %ly% EQU 0 (set dd=29) else (set dd=28)
)
:Dec_date_end
if %dd% LSS 10 set dd=0%dd%
if %mm% LSS 10 set mm=0%mm%
endlocal & (set %1=%yy%)&(set %2=%mm%)&(set %3=%dd%)
goto :eof

Dr John Stockton

unread,
Jul 6, 2004, 7:09:27 AM7/6/04
to
JRS: In article <2kuppiF...@uni-berlin.de>, seen in
news:alt.msdos.batch.nt, Todd Vargo <todd_...@nccw.net> posted at Tue,
6 Jul 2004 00:58:30 :

The month lengths can be calculated by Zeller's method.

It would be more generally useful to have individual methods for :

* Determining date as Y M D variables, either independently of
localisation or with manifestly explicit dependence; it's not manifest
which date formats Frank's code can/cannot accept, or whether that is
relevant. ISTM that it will not accept Y M D dates; those have been
available in DOS localisations since at least V5.

* Using Y M D variables, determine a standard DayCount such as MJD CJD
or CMJD; JD is unsuitable. M & D should be allowed to exceed their
calendar range.

* The reverse of the previous.

* The day number in the ISO week, which is (DayCount+X) mod 7 + 1,

It is then trivial to determine yesterday, the day before yesterday,
tomorrow, next Monday, the last but one Tuesday of the month after next.

Apart from the month-lengths, the code will fail on 2100-03-01. A
simple comment will do; but the more general code suggested above should
be made to deal properly with the Gregorian calendar, since the
originator cannot know how widely it will be used.

Methods : <URL:http://www.merlyn.demon.co.uk/zeller-c.htm> etc.; I will
be pleased to link to reliable, effective methods for a.m.b/a.m.b.nt .

Yesterday's date is the output of NOWMINUS D1 F1 R .

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME. ©
Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.

Matthias Tacke

unread,
Jul 6, 2004, 5:09:26 PM7/6/04
to
Deane <garrydeane at yahoo.com.au> wrote:
<snip>
>Also for what it's worth, here's my version (NT or higher).
>
>Garry
>
Hello Garry, another FWIW :-)

After having understood the clever way with the reversed "one" bit array,
I took the effort to code a two bit array as an offset to 28, so no
exception handling for february is necessary.
I also rewrote the leap year to be included in the array.

The leap year var %ly% is calculated by anding the year with 7 (bin 111)
If the result is not 4 (bin 100) %ly% is zeroed (no leap year).

The reversed 2 bit array happens to need an additonal four to add the
one to make the 29th in a leap year, so the routine can simply add the
ly to the bit array which is coded as a hex value.

Month Dec Nov Oct Sept Aug Jul Jun Mai Apr Mar Feb Jan
Days 31 30 31 30 31 31 30 31 30 31 28 31
-28= 3 2 3 2 3 3 2 3 2 3 0 3
bin 11 10 11 10 11 11 10 11 10 11 00 11
hex E E F B B 3
In case of leap year +4 01 00

only Dec_Date is changed.

For my locale (german) I had to change yy and dd to jj and tt back and
forth, so I'd appreciate any feedback about possible problems.

:: ------------------------------------------------------------------
:Dec_Date yy mm dd
:: ------------------------------------------------------------------
setlocal
:: Strip leading zeros from possible octals and decrement the day
call set /a yy=%1, mm=100%%%2%%%%%%100, dd=100%%%3%%%%%%100-1
if %dd% NEQ 0 goto :Dec_date_end
:: Today is the 1st of the month - decrement the month
:: and set leap year check (ignoring centuries)

set /a mm-=1,"ly=yy&7" &if "%ly%" NEQ "4" set ly=0

:: If today is 1 Jan, set date to 31st Dec
if %mm% EQU 0 (set /a dd=31, mm=12, yy-=1) else (
rem Calculate days in last month (by Frank Westlake)

set /a "dd=((0xEEFBB3+%ly%)>>((%a-1)*2)&3)+28"


)
:Dec_date_end
if %dd% LSS 10 set dd=0%dd%
if %mm% LSS 10 set mm=0%mm%
endlocal & (set %1=%yy%)&(set %2=%mm%)&(set %3=%dd%)
goto :eof

--
Greetings
Matthias________________________________________
For help on nt commands enter in a cmd window:
W2K>HH windows.chm::ntcmds.htm XP>HH ntcmds.chm

Matthias Tacke

unread,
Jul 6, 2004, 7:30:41 PM7/6/04
to
"Matthias Tacke" wrote:
>
>The leap year var %ly% is calculated by anding the year with 7 (bin 111)
>If the result is not 4 (bin 100) %ly% is zeroed (no leap year).
>
Seems I tried to make it too elegant - didn't work with the leap year
that way. After some testing the elimination of the february handling
works well.

::Yesterday3.cmd:::::::::::::::::::::::::::::::::::::::::::::::::::::
@echo off
setlocal enabledelayedexpansion
For /L %%a in (1990,1,2008) do (
set /A jj=%%a,mm=01,tt=01
set /P _="!jj!-!mm!-!tt! "<nul
call :Dec_Date jj mm tt
echo Yesterday was !jj!-!mm!-!tt!

set /A jj=%%a,mm=03,tt=01
set /P _="_!jj!-!mm!-!tt! "<nul
call :Dec_Date jj mm tt
echo Yesterday was !jj!-!mm!-!tt!

set /A jj=%%a,mm=!random!%%12+1,tt=!random!%%28+1
set /P _="__!jj!-!mm!-!tt! "<nul
call :Dec_Date jj mm tt
echo Yesterday was !jj!-!mm!-!tt!
)
goto :eof
:: ------------------------------------------------------------------
:Dec_Date jj mm tt


:: ------------------------------------------------------------------
setlocal
:: Strip leading zeros from possible octals and decrement the day

call set /a jj=%1, mm=100%%%2%%%%%%100, tt=100%%%3%%%%%%100-1
if %tt% NEQ 0 goto :Dec_date_end


:: Today is the 1st of the month - decrement the month
:: and set leap year check (ignoring centuries)

set /a mm-=1, "ly=jj%%4"
if %ly% EQU 0 (set ly=4) else (set ly=0)


:: If today is 1 Jan, set date to 31st Dec

if %mm% EQU 0 (set /a tt=31, mm=12, jj-=1) else (
rem Calculate days in last month (by Frank Westlake/Matthias Tacke)
set /a "tt=((0xEEFBB3+%ly%)>>((!mm!-1)*2)&3)+28"
)
:Dec_date_end
if %tt% LSS 10 set tt=0%tt%


if %mm% LSS 10 set mm=0%mm%

endlocal & (set %1=%jj%)&(set %2=%mm%)&(set %3=%tt%)
goto :eof
::Yesterday3.cmd:::::::::::::::::::::::::::::::::::::::::::::::::::::

Todd Vargo

unread,
Jul 6, 2004, 7:46:48 PM7/6/04
to

"Phil Robyn" <zipp...@berkeley.edu> wrote in message
news:2kuor1F...@uni-berlin.de...

> Todd Vargo wrote:
> > IIRC, SET/A is not available in NT. ;-)
> No, 'set /a' *is* available in NT4.0.

Don't know where I got that idea from.
Thanks for setting me strait.

Timo Salmi

unread,
Jul 6, 2004, 10:51:27 PM7/6/04
to
Matthias Tacke <Matthia...@web.de> wrote:
> ::Yesterday3.cmd:::::::::::::::::::::::::::::::::::::::::::::::::::::

This is an interesting exercise. But since it has been solved for
other languages many times over, you may wish to utilize code, and
make sure with (Zeller), such as referred to in e.g.

3) What is the code for the weekday of a given date?
119) What is the Pascal code to add a number of days to a date?
129) How can I find out if a date is a valid date?

165966 Jan 8 2000 ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip
tsfaqp.zip Common Turbo Pascal Questions and Timo's answers

All the best, Timo

--
Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance ; University of Vaasa
mailto:t...@uwasa.fi <http://www.uwasa.fi/~ts/> ; FIN-65101, Finland

Useful script files and tricks ftp://garbo.uwasa.fi/pc/link/tscmd.zip

Garry Deane

unread,
Jul 6, 2004, 10:58:45 PM7/6/04
to
On Wed, 7 Jul 2004 01:30:41 +0200, "Matthias Tacke"
<Matthia...@web.de> wrote:

>Seems I tried to make it too elegant - didn't work with the leap year
>that way. After some testing the elimination of the february handling
>works well.

<snip>


>:: ------------------------------------------------------------------
>:Dec_Date jj mm tt
>:: ------------------------------------------------------------------
>setlocal
>:: Strip leading zeros from possible octals and decrement the day
>call set /a jj=%1, mm=100%%%2%%%%%%100, tt=100%%%3%%%%%%100-1
>if %tt% NEQ 0 goto :Dec_date_end
>:: Today is the 1st of the month - decrement the month
>:: and set leap year check (ignoring centuries)
>set /a mm-=1, "ly=jj%%4"
>if %ly% EQU 0 (set ly=4) else (set ly=0)
>:: If today is 1 Jan, set date to 31st Dec
>if %mm% EQU 0 (set /a tt=31, mm=12, jj-=1) else (
> rem Calculate days in last month (by Frank Westlake/Matthias Tacke)
> set /a "tt=((0xEEFBB3+%ly%)>>((!mm!-1)*2)&3)+28"
> )
>:Dec_date_end
>if %tt% LSS 10 set tt=0%tt%
>if %mm% LSS 10 set mm=0%mm%
>endlocal & (set %1=%jj%)&(set %2=%mm%)&(set %3=%tt%)
>goto :eof
>::Yesterday3.cmd:::::::::::::::::::::::::::::::::::::::::::::::::::::

Thanks Matthias, that's a very nice improvement. I made a couple of
minor changes to make it compatible with NT4 by eliminating the
parentheses and shifting the bit string left 2 so that it uses mm*2
instead of (mm-1)*2.

Here's what I ended up with (localised back to English):

:: ------------------------------------------------------------------
:Dec_Date yy mm dd

:: ------------------------------------------------------------------
setlocal
:: Strip leading zeros from possible octals and decrement the day

call set /a yy=%1, mm=100%%%2%%%%%%100, dd=100%%%3%%%%%%100-1

if %dd% NEQ 0 goto :Dec_date_end


:: Today is the 1st of the month - decrement the month
:: and set leap year check (ignoring centuries)

set /a mm-=1, ly=yy%%4
if %ly% EQU 0 (set ly=16) else (set ly=0)


:: If today is 1 Jan, set date to 31st Dec

if %mm% EQU 0 (set /a dd=31, mm=12, yy-=1) else (


rem Calculate days in last month (by Frank Westlake/Matthias Tacke)

set /a "dd=0x3BBEECC+ly>>mm*2&3, dd+=28"


)
:Dec_date_end
if %dd% LSS 10 set dd=0%dd%

if %mm% LSS 10 set mm=0%mm%

Todd Vargo

unread,
Jul 7, 2004, 12:34:17 AM7/7/04
to

"Matthias Tacke" <Matthia...@web.de> wrote in message
news:ccfcn1$d1q$01$1...@news.t-online.com...

> "Matthias Tacke" wrote:
> >
> >The leap year var %ly% is calculated by anding the year with 7 (bin 111)
> >If the result is not 4 (bin 100) %ly% is zeroed (no leap year).
> >
> Seems I tried to make it too elegant - didn't work with the leap year
> that way. After some testing the elimination of the february handling
> works well.
>
> ::Yesterday3.cmd:::::::::::::::::::::::::::::::::::::::::::::::::::::

I sure wish WIN95CMD worked correctly. I can not get yours to work because
redirection with win95cmd is screwy.

I got this output...

E:\>y3
1990-1-1 Yesterday was 1989-12-31
_1990-3-1 Yesterday was 1990-02-28
__1990-6-25 Yesterday was 1990-06-24
...

_2008-3-1 Yesterday was 2008-02-29
__2008-6-18 Yesterday was 2008-06-17


Ok, I'll take a stab at this too. If this works, the output will be in the
yyyymmdd format. I notice Frank-Peter used FIND.EXE but provided a path to
it. Does that mean it is not in path by default?

@echo off
setlocal
for /f "tokens=*" %%A in ('date/t') do set date=%%A
::set date=Sun 07/07/2004 <<for my testing only
::set date=2004-06-08 <<for my testing only
for /f "tokens=1-4 delims=/-. " %%A in ("%date%") do (
call :getdate %%A %%B %%C %%D)
echo Yesterday=%yyyy%%mm%%dd%
goto :eof
:getdate
if not %4.==. shift
set mm=1%1&set dd=1%2&set yyyy=%3
echo.|date|find "(mm"|rem
if errorlevel 1 set mm=1%2&set dd=1%1
if 1%1 gtr 131 set yyyy=%1&set dd=1%3
set /a dd-=1
if %dd% equ 100 set dd=131&call :month 04 06 09 11
if %mm% equ 102 set dd=128&set /a leap=%yyyy% %% 4
if %leap%. equ 0. set dd=129
set dd=%dd:~-2%
set mm=%mm:~-2%
goto :eof
:month
set /a mm-=1
if %mm% equ 100 set mm=112&set /a yyyy-=1
:loop
if %mm% equ 1%1 set dd=130&goto :eof
shift
if not %1.==. goto loop
goto :eof

Dr John Stockton

unread,
Jul 7, 2004, 8:37:56 AM7/7/04
to
JRS: In article <ccfoff$m...@poiju.uwasa.fi>, seen in
news:alt.msdos.batch.nt, Timo Salmi <t...@UWasa.Fi> posted at Wed, 7 Jul
2004 05:51:27 :

>Matthias Tacke <Matthia...@web.de> wrote:
>> ::Yesterday3.cmd:::::::::::::::::::::::::::::::::::::::::::::::::::::
>
>This is an interesting exercise. But since it has been solved for
>other languages many times over, you may wish to utilize code, and
>make sure with (Zeller), such as referred to in e.g.
>
> 3) What is the code for the weekday of a given date?

In that, A1 should be removed, except for WeekDayString, which should be
modified for ISO day-of-week (just change +1 to -2, ISTM. Straight
Zeller is so much better. FirstThursday can be obtained simply from
D=DayOfWeek(Y, 1, 3); something like 7 - D mod 7

<URL: http://www.merlyn.demon.co.uk/zeller-c.htm> etc.

> 119) What is the Pascal code to add a number of days to a date?

Better with ISO day-of-week? Straight Zeller will simplify A2;
procedures cj & jd are location-dependent (failing spectacularly for
Sweden 1700-1712) which should be noted.

> 129) How can I find out if a date is a valid date?

The length of a month can be obtained with a lookup in [31, 28, 31, ...]
; if that test fails, then if the day is 29 one tests for a leap year.
With short-circuit evaluation, Pascal untested,

OK := (M>0) and (M<13) and (D>0) and
( (D<=Arr[M]) or ( (D=29) and Leap(Y) ) )

Matthias Tacke

unread,
Jul 7, 2004, 3:17:45 PM7/7/04
to
"Todd Vargo" wrote:
>"Matthias Tacke" <Matthia...@web.de> wrote
>> "Matthias Tacke" wrote:
>> >The leap year var %ly% is calculated by anding the year with 7 (bin 111)
>> >If the result is not 4 (bin 100) %ly% is zeroed (no leap year).
>> >
>> Seems I tried to make it too elegant - didn't work with the leap year
>> that way. After some testing the elimination of the february handling
>> works well.
>>
>> ::Yesterday3.cmd:::::::::::::::::::::::::::::::::::::::::::::::::::::
>
>I sure wish WIN95CMD worked correctly. I can not get yours to work because
>redirection with win95cmd is screwy.
>
>I got this output...
>
>E:\>y3
>1990-1-1 Yesterday was 1989-12-31
>_1990-3-1 Yesterday was 1990-02-28
>__1990-6-25 Yesterday was 1990-06-24
>...
>
>_2008-3-1 Yesterday was 2008-02-29
>__2008-6-18 Yesterday was 2008-06-17
>

Hello Todd, for testing purposes I choose for each year Jan 1st,Mar 1st
and a random generated month and day, so the output seems o to me.

>
>Ok, I'll take a stab at this too. If this works, the output will be in the
>yyyymmdd format. I notice Frank-Peter used FIND.EXE but provided a path to
>it. Does that mean it is not in path by default?

I guess it should be, but it is possible he has a different find in his
path ?

<snip>

--
Greetings_Matthias___________________________________________________
Have a look at: XP> <hh.exe ntcmds.chm::/ntcmds_new_tools.htm>
W2k and XP> <hh.exe ntcmds.chm::/dos_diffs.htm>
http://groups.google.com/groups?group=alt.msdos.batch.nt&q=help

Matthias Tacke

unread,
Jul 7, 2004, 3:23:29 PM7/7/04
to
Deane <garrydeane at yahoo.com.au> wrote:
>
>Thanks Matthias, that's a very nice improvement. I made a couple of
>minor changes to make it compatible with NT4 by eliminating the
>parentheses and shifting the bit string left 2 so that it uses mm*2
>instead of (mm-1)*2.
>
>Here's what I ended up with (localised back to English):
>
Thanks for that Garry,
since nt compatibility is still an issue for many readers I'll use your
variant in future.

For batches in practise the valid leap year range is IMO of less
importance for a yesterday "function"

Mabden

unread,
Jul 8, 2004, 4:10:10 PM7/8/04
to
"Matthias Tacke" <Matt...@Tacke.de> wrote in message
news:cchijg$1kf$04$1...@news.t-online.com...

> Deane <garrydeane at yahoo.com.au> wrote:
> >
> For batches in practise the valid leap year range is IMO of less
> importance for a yesterday "function"
>

Apparently, since 2100 will not be a leap year, but your batch shows it as
one. Neither will 2200, or 2300, etc. But it will be right in 2400 and 2800!
;-)

"Even a broken batch file is right twice a millennium."

--
Mabden


Matthias Tacke

unread,
Jul 8, 2004, 5:09:44 PM7/8/04
to
"Mabden" wrote:

You are right. Anybody who wants to complain about that, may send me a
postcard when it happens.

Frank-Peter Schultze

unread,
Jul 10, 2004, 6:10:11 AM7/10/04
to
"Matthias Tacke" <Matt...@Tacke.de> wrote in message news:<cchi8p$kje$03$1...@news.t-online.com>...
> "Todd Vargo" wrote:
[...]

> I notice Frank-Peter used FIND.EXE but provided a path to
> >it. Does that mean it is not in path by default?
>
> I guess it should be, but it is possible he has a different find in his
> path ?

It is good practice to provide the path to the OS' external commands.
This avoids conflicts with different commands that have the same name.

In a batch file for NT-based systems I use variables like
%SystemRoot%, of course. If one uses Windows 9x w/ Win95cmd he has to
fix that batch file - or switch to Windows XP, he he he...

Mabden

unread,
Jul 10, 2004, 3:08:17 PM7/10/04
to
"Frank-Peter Schultze" <ng-r...@fpschultze.de> wrote in message
news:b2a353ab.04071...@posting.google.com...

> "Matthias Tacke" <Matt...@Tacke.de> wrote in message
news:<cchi8p$kje$03$1...@news.t-online.com>...
> > "Todd Vargo" wrote:
> [...]
> > I notice Frank-Peter used FIND.EXE but provided a path to
> > >it. Does that mean it is not in path by default?
> >
> > I guess it should be, but it is possible he has a different find in his
> > path ?
>
> It is good practice to provide the path to the OS' external commands.
> This avoids conflicts with different commands that have the same name.
>

That's just crazy-talk. Hardcoded paths would make my set of batch files an
insane nightmare of changes for each OS with the resultant timestamp
changes. No thanks. At the very least, use your own variable (i.e.
"%dosdir%) and set it once in the autoexec or a batch file (I call mine
settings.bat) which you call when the command box is opened. Now you can
upgrade your OS or move your "Belfry directory" (you know, where the bats
live) with a one line change.

--
Mabden

0 new messages