editing a file

  • Thread starter Thread starter aaron
  • Start date Start date
A

aaron

i have exported a registry key(test.reg) from a batch
file and now i am trying to edit one of the lines in the
test.reg key and then import it back into the registry.
in the batch i used SET /P REPLY=ENTER USERNAME so the
line in the registry key that i want to edit i will use
%reply%, import it back into the registry and then delete
the test.reg. im just not sure what commands to use to
edit the the registry key? any advice is helpful. thanks
 
aaron said:
i have exported a registry key(test.reg) from a batch
file and now i am trying to edit one of the lines in the
test.reg key and then import it back into the registry.
in the batch i used SET /P REPLY=ENTER USERNAME so the
line in the registry key that i want to edit i will use
%reply%, import it back into the registry and then delete
the test.reg. im just not sure what commands to use to
edit the the registry key? any advice is helpful. thanks

It's quite unclear what you want to do.
- I'd use reg.exe instead of tampering with .reg files.
Included with xp and in the support tools for w2k.
- If you want to change the settings for a different user - it isn't
just exchanging a username. You've to get access to a different hive.
- editing of files might be done with edlin, sed, a for loop, a wsh
script, a debug script, a qbasic program.... - it depends on the task.

Please give some more details
 
the batch file that i am trying to write will change the
name of the last user that was logged on at the login
screen.

@echo off
echo.
echo.
set /p reply=enter username
reg export "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon"

so now i need to edit these two stirngs in this reg key
from

"AltDefaultUserName"="USERNAME"
"DefaultUserName"="USERNAME"

to

"AltDefaultUserName"="%reply%"
"DefaultUserName"="%reply%"

and them import it back into the registry.
 
aaron said:
the batch file that i am trying to write will change the
name of the last user that was logged on at the login
screen.

@echo off
echo.
echo.
set /p reply=enter username
reg export "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon"

so now i need to edit these two stirngs in this reg key
from

"AltDefaultUserName"="USERNAME"
"DefaultUserName"="USERNAME"

to

"AltDefaultUserName"="%reply%"
"DefaultUserName"="%reply%"

and them import it back into the registry.
Hi

No need to go through a registry file at all:

@echo off
echo.
echo.
set /p reply=enter username:
set regkey="HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
reg.exe add %regkey% /v AltDefaultUserName /d %reply% /t REG_SZ /f
reg.exe add %regkey% /v DefaultUserName /d %reply% /t REG_SZ /f
 
There is no need to export. Type
reg add /?

reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AltDefaultUserName /t REG_SZ /d %windir%

This adds windir (c:\windows), replace it with %reply%
 
David said:
There is no need to export. Type
reg add /?

reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AltDefaultUserName /t REG_SZ /d %windir%
Hi

You will need to add /f ("Force overwriting the existing registry
entry without prompt") at the end of the reg statement.
 
Type? Where?

When done from a cmd prompt Windows tells me "there is no
such command".

There is no need to export. Type
reg add /?

reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AltDefaultUserName /t REG_SZ /d %windir%

This adds windir (c:\windows), replace it with %reply%

Lars
Stockholm
 
Type? Where?

When done from a cmd prompt Windows tells me "there is no
such command".

It should be in C:\Program Files\Support Tools\; if not, install them.
They are on the installation CD.
 
Back
Top