VBS如果存在注册表值,则运行一些东西

时间:2013-09-25 15:53:22

标签: vbscript registry windows-xp

嗨,大家好我想创建一个脚本,它将查看wi​​ndows xp的安装语言,然后根据注册表中列出的语言,它将执行命令并修改另一个位置的值。

我已经使用它,但当值等于字符串时它失败了。请参阅附件

当寻找芬兰040B时,它失败了,我得到了预期然后声明如果使用

if (strvalue) = 040B Then  hence i then switched to see if can read the full value of registry but still fails.

请帮忙,

我正在运行19种语言,所以其他语言也是字符串格式。

RegKey= "InstallLanguage"
strKeyPath = "SYSTEM\ControlSet001\Control\Nls\Language"
objRegistry.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,RegKey,strValue

'检查值是否存在

'如果不是IsNull(strValue)那么

If (strValue) = 0407 Then
    objWSHShell.Run "c:\programdata\wmg\LyncMUI32.exe /passive /norestart"
    objRegistry.SetDWORDValue HKEY_CURRENT_USER, LyncKey, strLang, Ger
    Else 
    If (strValue) = 0804 Then ' chinese Simplifed
        objWSHShell.Run "c:\programdata\wmg\LyncMUI32.exe /passive /norestart"
        objRegistry.SetDWORDValue HKEY_CURRENT_USER, LyncKey, strLang, chismp
    Else 
    If (strValue) = 0404 Then ' chinese Traditional
        objWSHShell.Run "c:\programdata\wmg\LyncMUI32.exe /passive /norestart"
        objRegistry.SetDWORDValue HKEY_CURRENT_USER, LyncKey, strLang, ChiTrad
        Else 
        If (strValue) = 0406 Then ' danish
            objWSHShell.Run "c:\programdata\wmg\LyncMUI32.exe /passive /norestart"
            objRegistry.SetDWORDValue HKEY_CURRENT_USER, LyncKey, strLang, Dan
            Else 
            If (strValue) = 0413 Then ' dutch
                objWSHShell.Run "c:\programdata\wmg\LyncMUI32.exe /passive /norestart"
                objRegistry.SetDWORDValue HKEY_CURRENT_USER, LyncKey, strLang, Dtc
                Else 
                'strfinland = "040B"
                    if (strValue = 040B) Then
                    'If objRegistry.EnumValue(HKEY_LOCAL_MACHINE, "SYSTEM\ControlSet001\Control\Nls\Language", "InstallLanguage", strfinland) = 0 Then 'finnish
                        msgbox "Finland"
                        objWSHShell.Run "c:\programdata\wmg\LyncMUI32.exe /passive /norestart"
                        objRegistry.SetDWORDValue HKEY_CURRENT_USER, LyncKey, strLang, Fin
                        Else 

0 个答案:

没有答案
相关问题