0
votes

I am new to VBscript. I am writing a script to read a registry. I have declared a variable but the browser shows an error "Expected end of statement"

This is my function :

<script type="text/vbscript">

  Function SayHello()
    MsgBox "Hello"

HKEY_LOCAL_MACHINE = &H80000002
uninstallRegKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\";
stdRegPro = "winmgmts:{impersonationLevel=impersonate}!\\\\.\\root\\default:StdRegProv";

Set objReg=GetObject(stdRegPro)

objReg.EnumKey HKEY_LOCAL_MACHINE, uninstallRegKey, arrSubKeys
MsgBox arrSubKeys

  End Function

</script>

It gives error at declaring variable uninstallRegKey at the end of the statement (near semicolon)

Am I doing something wrong?

1
Is this as a .vbs, a .hta, a .wsh, or a .htm(l) file? - Ansgar Wiechers

1 Answers

4
votes

No ; statement delimiter in VBScript!