The system was unable to find the specified registry key or value

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Docfxit
Posts: 9
Joined: 12 Nov 2015 12:42

The system was unable to find the specified registry key or value

#1 Post by Docfxit » 10 Jan 2019 04:57

In a batch file I have:

Code: Select all

set "RegKey="HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify""
reg delete %regkey% /v PastIconsStream=- /f
This is what I get when I run it:

Code: Select all

C:\Windows\System32>reg delete "HKCU\Software\Classes\Local Settings\Software\Mi
crosoft\Windows\CurrentVersion\TrayNotify" /v PastIconsStream=- /f
ERROR: The system was unable to find the specified registry key or value.
I have been able to code it a little different so it finds the key but then it doesn't recognize the /f and asks me if I want to delete it.
How can it be changed to find the key?

Thanks,
Docfxit

aGerman
Expert
Posts: 3441
Joined: 22 Jan 2010 18:01
Location: Germany

Re: The system was unable to find the specified registry key or value

#2 Post by aGerman » 10 Jan 2019 10:48

Right now I created that value and tried to delete it using your line. It perfectly works for me. But the value name PastIconsStream=- seems to be weird. Are you sure the =- belong to the name or isn't it rather only PastIconsStream?

Steffen

Docfxit
Posts: 9
Joined: 12 Nov 2015 12:42

Re: The system was unable to find the specified registry key or value

#3 Post by Docfxit » 10 Jan 2019 12:00

This is what the key looks like coming from the registry:

Code: Select all

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify]
"PromotedIconCache"="{7820NR76-23R3-4229-82P1-R41PO67Q5O9P},{7820NR75-23R3-4229-82P1-R41PO67Q5O9P},{7820NR74-23R3-4229-82P1-R41PO67Q5O9P},{7820NR73-23R3-4229-82P1-R41PO67Q5O9P}"
"LastAdvertisement"=hex(b):83,37,2d,81,a7,a8,d4,01
"UserStartTime"=hex(b):fb,02,c3,91,80,b6,d3,01
"PastIconsStream"=hex:14,00,00,00,05,00,00,00,01,00,01,00,91,00,00,00,14,00,00,\
  00,49,4c,20,06,91,00,50,01,d0,01,14,00,14,00,ff,ff,ff,ff,21,10,ff,ff,ff,ff,\
  ff,ff,ff,ff,42,4d,36,00,00,00,00,00,00,00,36,00,00,00,28,00,00,00,14,00,00,\
  <continued>
Thank you for your feedback,
Docfxit

Docfxit
Posts: 9
Joined: 12 Nov 2015 12:42

Re: The system was unable to find the specified registry key or value

#4 Post by Docfxit » 10 Jan 2019 12:04

This finds the registry key but requires me to answer the delete:

Code: Select all

set "RegKey=HKEY_LOCAL_MACHINE\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify" /v "PastIconsStream"=-"
reg delete "%regkey%" /f
And I get this:

Code: Select all

set "RegKey=HKEY_LOCAL_MACHINE\Software\Classes\Local Settings\Softwar
e\Microsoft\Windows\CurrentVersion\TrayNotify" /v "PastIconsStream"=-"

C:\Windows\System32>reg delete "HKEY_LOCAL_MACHINE\Software\Classes\Local Settin
gs\Software\Microsoft\Windows\CurrentVersion\TrayNotify" /v "PastIconsStream"=-"
 /f
Delete the registry value PastIconsStream=- /f (Yes/No)?
Thanks,
Docfxit

aGerman
Expert
Posts: 3441
Joined: 22 Jan 2010 18:01
Location: Germany

Re: The system was unable to find the specified registry key or value

#5 Post by aGerman » 10 Jan 2019 15:52

As I expected the value name is only PastIconsStream. So what's the reason for the =- in your code?

Code: Select all

reg delete "HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify" /v "PastIconsStream" /f
Steffen

Post Reply