|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
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. |
|
#3
|
|||
|
|||
|
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 |
|
#4
|
|||
|
|||
|
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" |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
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 |