WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Registry
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

RegQueryMulSz Problem

 Keywords: RegQueryMulSz Truncated String RegRead

Question:

I want to get the machines preffered interface language on a Win7 computer using:
Language = RegQueryMulSz(@REGCURRENT, "Control Panel\Desktop\MuiCached[MachinePreferredUILanguages]",@TAB,32)
Instead of getting "en-US" the answer is just "en-U".What I am doing wrong?

Answer:

You're not doing anything wrong. It looks like the underlying Win32 API functions aren't working as MSFT documentation describes for an REG_MULTI_SZ value with only a single string. We'll need to fix this in WinBatch with a workaround of some kind.

You could try using a COM Automation object that has the ability to read the registry as a workaround.

objWScript = ObjectCreate("WScript.Shell")
aValues = objWScript.RegRead("HKCU\Control Panel\Desktop\MuiCached\MachinePreferredUILanguages")
Message("MachinePreferredUILanguages", aValues[0])
We should have a 'RegQueryMulSz' fix in the following release. Thanks for taking the time to report the problem.
Article ID:   W18232
Filename:   RegQueryMulSz Problem .txt
File Created: 2012:10:22:08:02:28
Last Updated: 2012:10:22:08:02:28