Thread: batch file
View Single Post
  #4  
Old 01-05-2006, 05:06 AM
Michael Bednarek
 
Posts: n/a
Default Re: batch file

On Tue, 20 Dec 2005 07:39:07 -0800, cwtrex
<cwtrex@discussions.microsoft.com> wrote in
microsoft.public.windowsxp.security_admin:

>I'm trying to write a batch file, but I want to make it as readable as
>possible for future edits. I have a lot of if statements in a for loop and
>it only works if I put it on one line. Otherwise I get the error "0 was
>unexpected at this time" during a simple == comparison. What are the spacing
>rules for batch files? Can you not space it such as:
> if %_yestermonth% equ 2 (
> set /a _yesterday=%_yesterday% + 1
> )


AFAIK a "^" can be used to continue lines under CMD.EXE. Try this:

if %_yestermonth% equ 2 ( ^
set /a _yesterday=%_yesterday% + 1 ^
)

PS: A more descriptive Subject: line and a more appropriate newsgroup
might have elicited more useful responses.

--
Michael Bednarek http://mbednarek.com/ "POST NO BILLS"
Reply With Quote