English 中文(简体)
Reading registry values with cmake
原标题:

On a Windows 7 machine I cannot read any registry values that contain a semicolon.

For example if you have 7-zip, running the following

SET(MYPATH  [HKEY_LOCAL_MACHINE\SOFTWARE\7-Zip;Path])
MESSAGE("MYPATH = ${MYPATH}")

results in

MYPATH = [HKEY_LOCAL_MACHINESOFTWARE7-Zip;Path]

instead of the actual path as per the following thread. I think cmake support for registry paths that contain ";" are broken on Windows 7. Can somebody confirm this? Is there any work-around?

最佳回答

According to the wiki, you can t use SET to view the value of a registry key. The registry value is only read when you do some cache operation on it. For example, the following should output the path you want:

GET_FILENAME_COMPONENT(MYPATH "[HKEY_LOCAL_MACHINE\SOFTWARE\7-Zip;Path]"
                       ABSOLUTE CACHE)
MESSAGE("MYPATH = ${MYPATH}")
问题回答

暂无回答




相关问题
Is CLSID in registry for windows operating system is constant

I am developing a windows mobile application where i need to get a registry value of notification settings ,that is stored with CLSID as a key .Can i depend on the CLSID for retrieving the value of a ...

登记许可问题

vs2008, c. First time myhons# , it needs to establish a LM LMSoftware. 湿租赁

Reading registry values with cmake

On a Windows 7 machine I cannot read any registry values that contain a semicolon. For example if you have 7-zip, running the following SET(MYPATH [HKEY_LOCAL_MACHINE\SOFTWARE\7-Zip;Path]) ...

How to check visible resolution of system

I am not entirely sure how to word this questions so I am just going to explain my problem. My VB 6 program saves the location of the screen in the registry so that when it loads up again it can have ...

How to read and write to registry using VB.NET

How do I read, write and delete a registry using VB 2005/2008? Please give your explanation to your answer. I am really a registry noob... Thanks. I can t read any programming language other than vb.

Installing a Windows Service as a user

I m currently in the process of creating a Windows service application which will monitor changes to certain keys made in the HKEY_USERS registry. The way I do this is by collecting the SID of the ...

热门标签