batch file


Go Back   Computer Help Articles > Windows XP Security Admin
User Name
Password
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-05-2006, 05:05 AM
cwtrex
 
Posts: n/a
Default batch file

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.
Reply With Quote
  #2  
Old 01-05-2006, 05:05 AM
Ian
 
Posts: n/a
Default RE: batch file


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.


Reply With Quote
  #3  
Old 01-05-2006, 05:05 AM
David H. Lipman
 
Posts: n/a
Default Re: batch file

From: "Ian" <Ian@discussions.microsoft.com>

|
| 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.

--
Dave
http://www.claymania.com/removal-trojan-adware.html
http://www.ik-cs.com/got-a-virus.htm


Reply With Quote
  #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
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trouble with old SUS client Remy G. Windows Update 2 01-05-2006 05:20 PM
Hijack problem Tom B. Windows XP Security Admin 7 01-05-2006 05:44 AM
Need help fixing virus omi Windows XP Security Admin 6 01-05-2006 05:44 AM
EGroup.IEAccess.C (dialer) dtcar Windows XP Help and Support 22 01-05-2006 02:41 AM
USB Mass Storage Device - This device cannot start. (Code 10) lobo201 Windows XP Hardware 11 01-05-2006 02:15 AM


All times are GMT. The time now is 08:21 AM.


Powered by vBulletin Version 3.5.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd. SEO by vBSEO 2.3.2 © 2005, Crawlability, Inc.

batch file