title: Using Batch to change Computer Name and UserName based off of their current Computer Name?
body: <p>I'm writing a batch that I'll remotely place in the all users startup folder using Desktop Central 9 /PsExec. We are going to start using a naming convention as part of an initiative to overhaul computer management. This batch needs to find what the current PC Name is and then change it based off of what I will have manually defined in the batch itself. It would also be nice to be able to then also change the users name based off of what computer name is initially found. All computers use Windows 7 and above. I wrote a quick batch of what I think it should look like, minus the user name modification, but there are nuances here and there I must be getting wrong. The "If" statement is my weakness with batch, but I know it will be extremely efficient in this case. Can anyone correct what I'm doing wrong here? Much appreciated, this will help us A LOT!</p>
  
  <blockquote>
    <p>SET WMIC GET COMPUTERNAME %%CURRENT%</p>
    
    <p>If %%CURRENT% = THOMAS-PC then   REG ADD
    HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName /v
    ComputerName /t REG_SZ /d TGZ-DELL-001 /f</p>
    
    <p>If %%CURRENT% = CHARLES-PC then   REG ADD
    HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName /v
    ComputerName /t REG_SZ /d TGZ-DELL-002 /f</p>
    
    <p>If %%CURRENT% = MATHEW-PC then   REG ADD
    HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName /v
    ComputerName /t REG_SZ /d TGZ-DELL-003 /f</p>
  </blockquote>