Batch file help

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 batch 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.
 
Last edited:

My Computer

System One

  • Manufacturer/Model
    Acer Aspire 5630
    CPU
    Intel Core 2 Duo T5500 1.66GHz 65nm 667MHz FSB 2MB L2
    Motherboard
    Acer Grapevine Intel i945GM Chipset
    Memory
    2x1GB DDR2 333MHz
    Graphics card(s)
    Intel Integrated GMA 950 256MB
    Sound Card
    Realtek High Definition Audio
    Monitor(s) Displays
    15.4" WXGA Acer CrystalBrite LCD 16ms
    Screen Resolution
    1280x800
    Hard Drives
    200GB 5400rpm Toshiba MK2035GSS ATA-7, 250GB 7200rpm Maxtor External USB Hard Drive
Hi frankzappa77,

Here is the corrected code:

Code:
reg add HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe /v ScreenColors /t REG_DWORD /d 0x0000000a /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 0x000d0000 /f
reg add HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe /v FontFamily /t REG_DWORD /d 0x00000036 /f
reg add HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe /v FontWeight /t REG_DWORD /d 0x00000190 /f

The code itself was basically correct, it just needed some simple amendments.
Lines 1, 3, 4, and 5: 0x added to the front of the data field to indicate that the data following was in hexadecimal (0-9, A-F) as opposed to decimal (0-9).
Line 2: "" added around the data. When the item in question includes a space, enclose the term in quotes. The term here is Lucinda Console, so it should read "Lucinda Console". If in doubt, use quotes anyway.
 

My Computer

System One

  • Manufacturer/Model
    Dwarf Dwf/11/2012 r09/2013
    CPU
    Intel Core-i5-3570K 4-core @ 3.4GHz (Ivy Bridge) (OC 4.2GHz)
    Motherboard
    ASRock Z77 Extreme4-M
    Memory
    4 x 4GB DDR3-1600 Corsair Vengeance CMZ8GX3M2A1600C9B (16GB)
    Graphics card(s)
    MSI GeForce GTX770 Gaming OC 2GB
    Sound Card
    Realtek High Definition on board solution (ALC 898)
    Monitor(s) Displays
    ViewSonic VA1912w Widescreen
    Screen Resolution
    1440x900
    Hard Drives
    OCZ Agility 3 120GB SATA III x2 (RAID 0) Samsung HD501LJ 500GB SATA II x2 Hitachi HDS721010CLA332 1TB SATA II Iomega 1.5TB Ext USB 2.0 WD 2.0TB Ext USB 3.0
    PSU
    XFX Pro Series 850W Semi-Modular
    Case
    Gigabyte IF233
    Cooling
    1 x 120mm Front Inlet 1 x 120mm Rear Exhaust
    Mouse
    Microsoft Comfort Mouse 3000 for Business (USB)
    Keyboard
    Microsoft Comfort Curve Keyboard 3000 (USB)
    Internet Speed
    NetGear DG834Gv3 ADSL Modem/Router (Ethernet) ~4.0 Mb/s (O2)
    Other Info
    Optical Drive: HL-DT-ST BD-RE BH10LS30 SATA Bluray Lexmark S305 Printer/Scanner/Copier (USB) WEI Score: 8.1/8.1/8.5/8.5/8.25 Asus Eee PC 1011PX Netbook (Windows 7 x86 Starter)
Thanks a lot for that. So if I wanted to make the value a decimal value, I would just leave out the '0x'?
 

My Computer

System One

  • Manufacturer/Model
    Acer Aspire 5630
    CPU
    Intel Core 2 Duo T5500 1.66GHz 65nm 667MHz FSB 2MB L2
    Motherboard
    Acer Grapevine Intel i945GM Chipset
    Memory
    2x1GB DDR2 333MHz
    Graphics card(s)
    Intel Integrated GMA 950 256MB
    Sound Card
    Realtek High Definition Audio
    Monitor(s) Displays
    15.4" WXGA Acer CrystalBrite LCD 16ms
    Screen Resolution
    1280x800
    Hard Drives
    200GB 5400rpm Toshiba MK2035GSS ATA-7, 250GB 7200rpm Maxtor External USB Hard Drive
Hi frankzappa77,

Yes, you could do that. However, to avoid possible mistakes, convert the decimal number into hexadecimal format (use the scientific mode of the Calculator) and then use the syntax given above. For example, decimal 192 converts to hexadecimal C0, so the correct data would be 0x000000C0.
 

My Computer

System One

  • Manufacturer/Model
    Dwarf Dwf/11/2012 r09/2013
    CPU
    Intel Core-i5-3570K 4-core @ 3.4GHz (Ivy Bridge) (OC 4.2GHz)
    Motherboard
    ASRock Z77 Extreme4-M
    Memory
    4 x 4GB DDR3-1600 Corsair Vengeance CMZ8GX3M2A1600C9B (16GB)
    Graphics card(s)
    MSI GeForce GTX770 Gaming OC 2GB
    Sound Card
    Realtek High Definition on board solution (ALC 898)
    Monitor(s) Displays
    ViewSonic VA1912w Widescreen
    Screen Resolution
    1440x900
    Hard Drives
    OCZ Agility 3 120GB SATA III x2 (RAID 0) Samsung HD501LJ 500GB SATA II x2 Hitachi HDS721010CLA332 1TB SATA II Iomega 1.5TB Ext USB 2.0 WD 2.0TB Ext USB 3.0
    PSU
    XFX Pro Series 850W Semi-Modular
    Case
    Gigabyte IF233
    Cooling
    1 x 120mm Front Inlet 1 x 120mm Rear Exhaust
    Mouse
    Microsoft Comfort Mouse 3000 for Business (USB)
    Keyboard
    Microsoft Comfort Curve Keyboard 3000 (USB)
    Internet Speed
    NetGear DG834Gv3 ADSL Modem/Router (Ethernet) ~4.0 Mb/s (O2)
    Other Info
    Optical Drive: HL-DT-ST BD-RE BH10LS30 SATA Bluray Lexmark S305 Printer/Scanner/Copier (USB) WEI Score: 8.1/8.1/8.5/8.5/8.25 Asus Eee PC 1011PX Netbook (Windows 7 x86 Starter)
Back
Top