batch file

G

Guest

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
)

?

Thanks ahead of time for any help on the subject.
 
G

Guest

No. Batch files don't support continuation of lines.

If you're doing something more than a simple task you might be better to
look at a 'real' scripting language. There are several good free ones, for
example VBScript which comes with Windows, AutoIt or KixStart.
 
D

David H. Lipman

From: "Ian" <[email protected]>

|
| No. Batch files don't support continuation of lines.
|
| If you're doing something more than a simple task you might be better to
| look at a 'real' scripting language. There are several good free ones, for
| example VBScript which comes with Windows, AutoIt or KixStart.
|

KiXtart is highly recommended !

http://kixtart.org KiXtart is CareWare.
 
M

Michael Bednarek

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top