Click here to Skip to main content
11,802,636 members (71,203 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: VBScript

I have the following code:

Option Explicit

Dim oReg
Dim strComputer,strValueName,arrValueNames
Dim strKeyPath1
Dim SyncMode5NameExists
ssig="Unable to open registry key"
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
strKeyPath1 = "Software\Microsoft\Windows\CurrentVersion\Internet Settings"
oReg.EnumValues HKEY_CURRENT_USER,strKeyPath1,arrValueNames
For Each strValueName In arrValueNames
	SyncMode5NameExists = (StrComp(strValueName,"SyncMode5"))
	If SyncMode5NameExists != 0 Then
		Wscript.Echo "bla,bla"	
	End If
	'Exit For
But, I get the following error, no idea what it is.
C:\scripts\test.vbs(20, 26) Microsoft VBScript compilation error: Expected ')

Thanks for your help,
Posted 7-Feb-13 8:10am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

If SyncMode5NameExists != 0 Then

should be
If SyncMode5NameExists <> 0 Then

That is the VB not equal sign.
namerg at 7-Feb-13 14:27pm
Hmm, so why the " Not equal to != " does not work ?
Mike Meinz at 7-Feb-13 14:53pm
The VBScript documentation says that != is not a valid VBScript comparison operator.

See Comparison Operators (VBScript)
aspnet_regiis -i at 7-Feb-13 15:01pm
Nice catch.. +5
Sergey Alexandrovich Kryukov at 7-Feb-13 18:42pm
Captain Obvious at work. My 5! :-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 KrunalRohit 366
1 OriginalGriff 365
2 F-ES Sitecore 295
3 Afzaal Ahmad Zeeshan 230
4 CPallini 230
0 OriginalGriff 2,950
1 Maciej Los 1,910
2 KrunalRohit 1,862
3 CPallini 1,695
4 Richard MacCutchan 1,157

Advertise | Privacy | Mobile
Web01 | 2.8.151002.1 | Last Updated 7 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100