Batch File to Change Username on Windows 7 Pro

Discussion in 'Windows 7 Help and Support' started by garciaj, Jun 5, 2013.

  1. garciaj

    garciaj New Member

    Jun 5, 2013
    Likes Received:
    How can I convert the batch below for Windows 7 Pro 64 bit. When I ran this batch in Windows XP; it worked! but not on Windows 7 Pro 64-bit. What this does? For example: I go to John Smith PC and you noticed that his username is smithj and domain: @@@@ was the last person that logon to that PC. So I need to logon as administrator and to fix his PC and logoff the PC but I wanted to put back his username as smithj NOT administrator.

    So I ran batch file below by going to Run as: C:\setuser smithj and press enter on Windows XP and it worked successfully BUT not Windows 7 Pro 64 bit. Also, the batch file is located under C:\

    if "%1"=="" goto error
    @set path=path %path%;c:\windows
    set tmpfile=C:\temp.reg
    echo REGEDIT4>%tmpfile%
    echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon]>>%tmpfile%
    echo "DefaultDomainName"="CALSB">>%tmpfile%
    echo "DefaultUserName"="%1">>%tmpfile%
    call regedit %tmpfile%
    del %tmpfile%
    goto exit
    echo You must specify the username!


Share This Page