Configure a Script to Run Once When a New User Logs OnImportant This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:
The Default User profile is created when Windows is installed. The first time a user logs on to a workstation (or domain), the Default User profile is copied to the user's profile.
To configure a script to run one time when a new user logs on, follow these steps:
- At a command prompt, type regedt32.exe.
- Click HKEY_USERS on the Windows menu.
- Click HKEY_USERS in the left panel, and then click Load Hive on the Registry menu.
- Locate the Profilepath\Default User\Ntuser.dat file, and then click Open. Give the hive a name such as "Test" when you are prompted.
NOTE: The Ntuser.dat file is hidden. If you are unable to locate, or load the Ntuser.dat file, in Windows Explorer, on the Tools menu, click Folder Options, and on the View tab, make sure that Hide file extensions for known file types is not selected, and that Show hidden files and folders is selected.For additional information about Windows 2000 User Profile storage, click the article number below to view the article in the Microsoft Knowledge Base:228445 User Profile Storage in Windows 2000
- Locate the following registry key where "test" is the name given to the loaded Ntuser.dat hive:HKEY_USERS\Test\Software\Microsoft\Windows\CurrentVersion\Runonce
- Click the Runonce key in the left pane, and then click Add Value on the Edit menu.
- Enter the following information for the new value:Value name: test.bat (you can name this anything)
Data Type: REG_SZ
String: c:\test.bat (this is the path to the file, and the file name)
- Click the "Test" hive, and then click Unload Hive on the Registry menu.
รหัสบทความ: 284193 - การตรวจสอบครั้งสุดท้าย: 16 ธ.ค. 2009 - ฉบับแก้ไข: 1