Link to home
Start Free TrialLog in
Avatar of Freeday
Freeday

asked on

Why am I getting this error with this VB Script?

The error is

Windows Script Host
---------------------------
Script: CDocuments and Settings\cs-ads-mbb30\Desktop\arms.vbs
Line: 5
Char: 121
Error: Expected 'Then'
Code: 800A03F9
Source: Microsoft VBScript compilation error

Set shell= WScript.CreateObject("WScript.Shell")
username = shell.ExpandEnvironmentStrings("%USERNAME%")
 
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists("C:\Documents and Settings\" & username & "\Start Menu\Programs\End2End, Inc\ARMS V2 R3.appref-ms")
Then
Wscript.Echo "ARMS Enterprise V2 R3 is already installed for " & username & " on this
computer. Click OK to close."
Else
Wscript.Echo "ARMS Enterprise V2 R3 is not installed for " & username & " on this
computer. Please click install when prompted."
CreateObject("Wscript.Shell").Run "\\cs-metroplex.cwru.edu\ARMSInstaller\Setup.exe"
 
End If

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Lukasz Chmielewski
Lukasz Chmielewski
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
In order for the IF statement to work you need to have IF Then in one line.

You cannot have your IF Else statement like below:

IF
Then
End IF

Solution
If    then
Else
End IF


Hope this solves your problem