Click here to Skip to main content
15,891,782 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I found this script to change username in MSOffice 2010. I have a sysprep image with the wrong username. Each time a new user profile is created it assigns the wrong username. I copied it to a text file and renamed is user.reg. I cannot get the script to run. I’m getting “The specified file is not a registry script. You can only import a binary registry files from within the registry editor.”

reg add HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo /v username /t reg_sz /d %username% /f

Any help would be appreciated.
Posted
Updated 25-Mar-14 10:55am
v2
Comments
[no name] 25-Mar-14 17:09pm    
http://forums.codeguru.com/showthread.php?351113-How-to-create-a-Registry-Script

1 solution

reg is a Command Prompt command. When you call reg add you are supposed to call it from cmd. Therefore, the easiest solution for you is to put your code to a file with and extension of .bat or .cmd. Create an empty file with .bat or .cmd extension and copy and paste
your command there:

reg add HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo /v username /t reg_sz /d %username% /f


BTW, if you really want to use a registry editor script (files with an extension of .reg) then change the file format like this:
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Office\Common\UserInfo]
"username"="xxxxxxxx"

By using this option you will not be able to pass Environment Variables. You will have to prepare the file content to populate the value in the .reg file
 
Share this answer
 
v3
Comments
Sergey Alexandrovich Kryukov 25-Mar-14 18:21pm    
Right, 5ed.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900