Batch file question

Forum Windows XP : Windows XP General Discussion - Batch file question

Tom's Hardware: Over 1.4 million members in 6 different countries available to answer all your high-tech questions. Sign up now! Its free!
Word :    Username :           
 

Archived from groups: microsoft.public.windowsxp.general (More info?)

 

Hello, All! please find here below my batch file.
(isdate d:\batch\temp.txt NOT EQUAL TODAY
if errorlevel 1 set true_=No
if errorlevel 0 set true_=Yes)

Even when the isdate command returns an errorlevel 1 the variable true_ sets
Yes. Somebody please point out the error in the batch file. Thanks in
advance.

With best regards, Brother Brock. E-mail: Nobodyknows@unknown.com

Sponsored Links
Register or log in to remove.

Archived from groups: microsoft.public.windowsxp.general (More info?)

 

What does "isdate" do ?

Mik

"Brother Brock" <Nobodyknows@unknown.com> wrote in message
news:OR5ZgTPpFHA.3996@TK2MSFTNGP12.phx.gbl...
> Hello, All! please find here below my batch file.
> (isdate d:\batch\temp.txt NOT EQUAL TODAY
> if errorlevel 1 set true_=No
> if errorlevel 0 set true_=Yes)
>
> Even when the isdate command returns an errorlevel 1 the variable
true_ sets
> Yes. Somebody please point out the error in the batch file. Thanks
in
> advance.
>
> With best regards, Brother Brock. E-mail: Nobodyknows@unknown.com
>
>

Reply to Mik

Archived from groups: microsoft.public.windowsxp.general (More info?)

 

http://msdn.microsoft.com/library/ [...] isdate.asp

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In news:ON7dqbQpFHA.3036@TK2MSFTNGP14.phx.gbl,
Mik <Mik@No-spam-mail.com> hunted and pecked:
> What does "isdate" do ?
>
> Mik
>
> "Brother Brock" <Nobodyknows@unknown.com> wrote in message
> news:OR5ZgTPpFHA.3996@TK2MSFTNGP12.phx.gbl...
>> Hello, All! please find here below my batch file.
>> (isdate d:\batch\temp.txt NOT EQUAL TODAY
>> if errorlevel 1 set true_=No
>> if errorlevel 0 set true_=Yes)
>>
>> Even when the isdate command returns an errorlevel 1 the variable true_
>> sets Yes. Somebody please point out the error in the batch file. Thanks
>> in advance.
>>
>> With best regards, Brother Brock. E-mail: Nobodyknows@unknown.com

Reply to Anonymous

Archived from groups: microsoft.public.windowsxp.general (More info?)

 

"Brother Brock" <Nobodyknows@unknown.com> wrote:

>Hello, All! please find here below my batch file.
>(isdate d:\batch\temp.txt NOT EQUAL TODAY
>if errorlevel 1 set true_=No
>if errorlevel 0 set true_=Yes)
>
>Even when the isdate command returns an errorlevel 1 the variable true_ sets
>Yes. Somebody please point out the error in the batch file. Thanks in
>advance.
>
>With best regards, Brother Brock. E-mail: Nobodyknows@unknown.com
>

errorlevel works on an "equal to or greater than" basis so you must
use a goto command to skip past the tests for lower values.


Try this:

if errorlevel 1 goto level1
(the preceding line will be processed if errorlevel is 1 or higher)

set true_=Yes
goto finish
(the above 2 lines will be processed only if errorlevel is less than
1)


:level1
set true_=No

:finish
(balance of batch file commands)

Good luck

Ron Martell Duncan B.C. Canada
--
Microsoft MVP
On-Line Help Computer Service
http://onlinehelp.bc.ca

In memory of a dear friend Alex Nichol MVP
http://aumha.org/alex.htm

Reply to Anonymous
Tom's Hardware > Forum > Windows XP > Windows XP General Discussion > Batch file question
Go to:

There are 541 identified and unidentified users. To see the list of identified users, Click here.

Please mind

You are about to answer a thread that has been inactive for more than 6 months.
If you still wish to proceed, please ensure that your posting is original and does not duplicate or overlap any prior responses to this thread.

Add a reply Cancel
Sponsored links
  • Ask the community now
  • Publish
Ad
They won a badge
Join us in greeting them