Re: Batch file help

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"Dave-UK" <here@xxxxxxxx> wrote in message
news:U--dnZxjtIx7_tjUnZ2dnUVZ8vmdnZ2d@xxxxxxxxxxxxxxx
"frankzappa77" <guest@xxxxxxxxxxxxxxxxx> wrote in message
news:bb162297eebb3ae87269bc33399ccea9@xxxxxxxxxxxxxxxxxxx

I want to add the following registry keys using a batch file. I don't
want the batch file to import the reg file, I want the batch file to
add
the keys itself.
This is the content of the reg file:

Code:
--------------------
[HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe]
"ScreenColors"=dword:0000000a
"FaceName"="Lucida Console"
"FontSize"=dword:000d0000
"FontFamily"=dword:00000036
"FontWeight"=dword:00000190
--------------------
This is what I put in my reg file after reading the reg /? and reg
add
/? page in cmd.

Code:
--------------------
reg add HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe /v
ScreenColors /t REG_DWORD /d 0000000a /f
reg add HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe /v
FaceName /t REG_SZ /d Lucida Console /f
reg add HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe /v
FontSize /t REG_DWORD /d 000d0000 /f
reg add HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe /v
FontFamily /t REG_DWORD /d 00000036 /f
reg add HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe /v
FontWeight /t REG_DWORD /d 00000190 /f
--------------------
But I get 4 errors and only one of them gets added successfully.


--
frankzappa77


It looks like Lucinda Console needs to be in quotes and you have
invalid numerical data in a couple of lines:

Here's my run of your batch file:
C:\Users\Admin\Desktop>reg add
HKEY_CURRENT_USER\Console\C:\Windows_system32_cmd
.exe /v ScreenColors /t REG_DWORD /d 0000000a /f
ERROR: Invalid syntax. Specify valid numeric value for '/d'.
Type "REG ADD /?" for usage.

C:\Users\Admin\Desktop>reg add
HKEY_CURRENT_USER\Console\C:\Windows_system32_cmd
.exe /v FaceName /t REG_SZ /d "Lucida Console" /f
The operation completed successfully.

C:\Users\Admin\Desktop>reg add
HKEY_CURRENT_USER\Console\C:\Windows_system32_cmd
.exe /v FontSize /t REG_DWORD /d 000d0000 /f
ERROR: Invalid syntax. Specify valid numeric value for '/d'.
Type "REG ADD /?" for usage.

C:\Users\Admin\Desktop>reg add
HKEY_CURRENT_USER\Console\C:\Windows_system32_cmd
.exe /v FontFamily /t REG_DWORD /d 00000036 /f
The operation completed successfully.

C:\Users\Admin\Desktop>reg add
HKEY_CURRENT_USER\Console\C:\Windows_system32_cmd
.exe /v FontWeight /t REG_DWORD /d 00000190 /f
The operation completed successfully.



In the REG_DWORD statements, either prefix the hex numbers with 0x to
indicate they are in hex (e.g. 0x0000000a) or convert the hex numbers to
binary and it should take them (e.g. 0000000a becomes 10, 00000036
becomes 54, etc.)

Hope this helps!

--
Zaphod

No matter where you go, there you are!


.



Relevant Pages

  • Re: Rollout Registry Settings via SMS (w/Adv Clients)
    ... success code of 0 is returned post-install, then a reg import is run. ... so I went with DFS. ... import, or because I'm a vbscript person, I'd probably write a vbscript to ... batch file can point to the DFS share where the registry entries are located. ...
    (microsoft.public.sms.swdist)
  • Re: Rollout Registry Settings via SMS (w/Adv Clients)
    ... success code of 0 is returned post-install, then a reg import is run. ... so I went with DFS. ... batch file can point to the DFS share where the registry entries are located. ...
    (microsoft.public.sms.swdist)
  • Re: script to execute file?
    ... It's a one line command run in a batch file. ... In a related question I was trying to add a reg setting through a batch ...
    (microsoft.public.scripting.vbscript)
  • Globally remove "Append parent suffixes of the primary domain suffix"
    ... The reg key is: ... both batch file and reg file go in the default domain ... group policy location for computer configuration, ... settings, scripts, startup. ...
    (microsoft.public.win2000.dns)
  • Re: Group Policy modifying Registry Keys
    ... Try the REG ADD command. ... run it locally or apply the changes to either the login script or the ... Jeffrey Randow (Windows Networking & Smart Display MVP) ... >program that creates two registry keys on the user's local machine. ...
    (microsoft.public.windows.server.networking)