System internals provides some useful gadgets, such as process explorer, File Monitor, and pstools. They are often used at work.
Especially in trouble-shooting, it is often able to get twice the result with half the effort.
Next, I will share with my colleagues about how to use registry monitor to set environment variables yesterday.
Problem description: colleague L is using wise for installation.ProgramThere are several installers. One of them is the main installer, and the other is called the sub-installer.
The main installer needs to set a system environment variable, and then read the value of this system environment variable when the sub-installer is running. Should this problem be simple ?!
Colleague l looked at wise's document and found that he only talked about how to read environment variables but didn't set them. So l wants to make a batch processing (. BAT) file to set this variable, the file content
Example:
Set myenvvar = testing_1
Then, call the batch file in the Wise script. However, this does not solve the problem because the environment variable name is temporary and only exists during the life cycle of the process running in the BAT file,
It does not affect subsequent processes or other parallel processes. After this process (which can be cmd.exe) is completed, the variable name ends. Of course, another possibility is that if this process is enabled
The child process can inherit its environment variables. But the method of this seed process is obviously not feasible for L, because there is no way to use the sub-installer as the sub-process of the batch processing program.
L after searching online for half a day, I found that there are still many people asking this question, but there is no simple solution. (This also shows that there is a lot of invalid information on the Internet, but there is little useful information, the Information Industry
Still promising .)
L come and ask me, my advice to L is: Set the environment variables with the "system attributes" that comes with the operating system, and enable registry monitor to check that the registry key has been modified. L tried it,
In less than two minutes.
Set the filter inclusion variable name for the Registry monitor:
When you click OK to set the variable, the Registry monitor is as follows:
The first record is the registry key we need to find:
HKLM/system/CurrentControlSet/control/Session Manager/environment/myenvvar
After finding this item, l quickly used the wise function to read and write the registry.
Conclusion: A gentleman is a good man or a good man. The rational use of tools makes your life much easier.
Happy programming!
Related links:
1. regmon for Windows v7.04
Http://technet.microsoft.com/en-us/sysinternals/bb896652.aspx
2. system internal (acquired by Microsoft and renamed windows sysinternals)
Http://technet.microsoft.com/en-us/sysinternals/default.aspx
Image address:
Http://blog.whitejadesoft.com