2

I am trying to change the Access Control permissions on a specific registry key i'm generating using a batch file. I try using regini.exe to pull the configuration from a .ini file and run into issues.

I keep getting this error:

    Z:\EM\Pre>regini.exe RegistryPermissions.ini 
    REGINI: CreateKey (\HKEY_CURRENT_CONFIG\Software\E) relative to handle (000000000) failed - 161
    REGINI: Failed to load from file 'RegistryPermissions.ini' (161)

This is the contents of my .ini file RegistryPermissions.ini:

Computer\HKEY_CURRENT_CONFIG\Software\E [1 7]

This is the batch script i'm writing to solve a problem:

@echo off
:: ==========================================
:: Set E Key
:: ==========================================
:: Date   : 11 October 2019
:: Author : 
:: Modified Date: 
:: Modified By: 
:: 
:: Script Details:
:: --------------
::  This script will:
::  + add the E Registry key to HKCC\Software
::  + set the Key permissions to allow "Everyone" full control
::  + reboot PC
:: ===========================================


::***************************************************************
:: Add E Registry Key to HKCC\Software                  *
::***************************************************************
REG ADD HKCC\Software\E

::***************************************************************
:: Set the Key to permissions to allow Everyone full control    *
::***************************************************************
=====This is where I need help=====


::***************************************************************
:: Reboot PC                            *
::***************************************************************



goto end

:end

I have removed some unnecessary sections of the script. The important part is changing the permissions on a registry key, with cmd.

Joe Bales
  • 21
  • 1
  • 4

2 Answers2

0

According to Wikipedia, HKEY_CURRENT_CONFIG is an alias to the path

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Hardware Profiles\Current

So try

\registry\machine\System\CurrentControlSet\Hardware Profiles\Current\Software\E [1 7]

and see if that works better.


If it still doesn't work, you might like to try another technique; registry permissions can be modified in Powershell, for example, or you can use the subinacl tool from Microsoft or various third-party tools.

(I found some suggestions here that might or might not be helpful.)

Harry Johnston
  • 5,875
  • 4
  • 35
  • 52
0

Run As Admin:

yourtext.txt (make sure that the Key itself has no [] HKEY_LOCAL_MACHINE\SOFTWARE\YourPath [1]

and than: Regini -m \%COMPUTERNAME% %HOMEDRIVE%%HOMEPATH%\DESKTOP\yourtext.txt