TAILIEUCHUNG - Using Windows Script Host to Modify the Registry phần 2

Figure : The dialog prompting the user to confirm creating of a new registry setting Figure : Displaying the contents of the newly created registry entry | Figure The dialog prompting the user to confirm creating of a new registry setting Figure Displaying the contents of the newly created registry entry Figure The dialog prompting the user to confirm deletion of the newly created registry setting s These dialog boxes allow the user to check modifications introduced to the registry at each step using for example Registry Editor Fig. . Figure You can use Registry Editor to check modifications introduced to the registry at each step of the script VBScript Examples If you prefer VBScript you can also use the above-described methods for accessing the registry notice the difference in the syntax of JScript and VBScript . Enabling and Disabling Changes to the Start Menu A small example is provided below developed using VBScript which in contrast to the previous one does something useful - it enables or disables changes to the Start Menu. In the previous chapter we discussed the values that control the Start menu. One such value is the NoChangeStartMenu under HKEY_CURRENT_USER SOFTWARE Microsoft Windows CurrentVersion Policies E xplorer. When this value is set to 1 one cannot make changes and when this value is set to 0 changes are allowed. Our small VBScript example first displays the dialog prompting the user to choose whether he or she needs to lock the Start menu Fig. . To manage the Start menu via the system registry the script creates the NoChangeStartMenu value and sets it to 1 if the user chooses to lock the Start menu. If the user clicks No the NoChangeStartMenu value will be set to 0. Next the script reads the NoChangeStartMenu value from the registry displays the current Start menu status and prompts the user to change it if desired Fig. . Figure Prompt for the user to lock Start menu Figure Prompt for the user to unlock Start menu The source code for this example is provided in Listing . Listing Source Code for the VBScript Example that Enables or Disables .

Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.