Thank you for that!  Working now.  

 

From: Damien Solodow [mailto:damien.solo...@harrison.edu] 
Sent: Thursday, September 15, 2011 2:37 PM
To: NT System Admin Issues
Subject: RE: if/else statement problem.

 

The ELSE clause must occur on the same line as the command after the IF.
For example:

 

    IF EXIST filename. (

        del filename.

    ) ELSE (

        echo filename. missing.

    )

 

The following would NOT work because the del command needs to be
terminated by a newline:

 

    IF EXIST filename. del filename. ELSE echo filename. missing

 

Nor would the following work, since the ELSE command must be on the same
line as the end of the IF command:

 

    IF EXIST filename. del filename.

    ELSE echo filename. missing

 

The following would work if you want it all on one line:

 

    IF EXIST filename. (del filename.) ELSE echo filename. missing

 

DAMIEN SOLODOW

Systems Engineer

317.447.6033 (office)

317.447.6014 (fax)

HARRISON COLLEGE

 

From: Jimmy Tran [mailto:jt...@teachtci.com] 
Sent: Thursday, September 15, 2011 5:26 PM
To: NT System Admin Issues
Subject: if/else statement problem.

 

Can someone please tell me what is wrong with this statement?

 

if exist "C:\Program Files (x86)\Malwarebytes' Anti-Malware\mbam.exe" (

REG ADD "HKLM\Software\Wow6432Node\Malwarebytes' Anti-Malware" /v
silentipmode /t REG_DWORD /d 1)

ELSE (

REG ADD "HKLM\Software\Malwarebytes' Anti-Malware" /v silentipmode /t
REG_DWORD /d 1)

 

I keep getting an error stating "else" is not a recognized command.  Is
there a better way to do this?  Running this on a W7 box.

 

Thanks

 

Jimmy

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here:
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to listmana...@lyris.sunbeltsoftware.com
with the body: unsubscribe ntsysadmin

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here:
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to listmana...@lyris.sunbeltsoftware.com
with the body: unsubscribe ntsysadmin


~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to listmana...@lyris.sunbeltsoftware.com
with the body: unsubscribe ntsysadmin

Reply via email to