Code: Select all
Hi guys, I got a problem with a ilegal string for a Registry entry.
i sometimes have to clean up the Windows Registry File using a commercial program and found it was having problems to delete some entry's.
When i tryed to delete the entry's manually i found that the registry refused the first attempt to delete the entry but complied on a second attempt.
Because there where to many to take out manually i wrote a short script to do this.
The script will read the entrys of a Text file that contains all the lines marked for deletion.
They look like the following 3 sample lines.
HKEY_CLASSES_ROOT\CLSID\{5CA3D70E-1895-11CF-8E15-001234567890}
HKEY_CLASSES_ROOT\CLSID\{6B58B5DD-7405-11D2-8F58-00E02916007D}
HKEY_CLASSES_ROOT\Typelib\{00A987AE-587B-4343-B826-89F17AB41A03}\1.0\HELPDIR
When i run my script i get a error message about a ilegal line on those, probably the brackets it dose not like.
Is there a way to make this work?
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
RegDelfile := "RegDel.txt"
IfExist, %RegDelfile%
{
Loop, read, %RegDelfile%
{
if Not (%A_LoopReadLine% = )
{
RegRead, OutputVar, %A_LoopReadLine%
if Errorlevel
{
MsgBox, Sorry the Registry dose not contain the line:`n%A_LoopReadLine%
}
else
{
MsgBox, 4,,OK to delete index: %A_Index% Line: %A_LoopReadLine%
IfMsgBox, Yes
{
RegDelete, %A_LoopReadLine%
if Errorlevel
{
sleep, 500
RegDelete, %A_LoopReadLine%
}
}
}
}
else
{
MsgBox, Sorry the index: %A_Index% in file: %RegDelfile% is empty
}
}
MsgBox, All *Done*`nEnding script
}
else
{
MsgBox, Regfile: %Regfile% not found`nEnding script
}