Computing.Net > Forums > Windows 2000 > vbscript RegDelete hive problem

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

vbscript RegDelete hive problem

Reply to Message Icon

Name: aznkd74
Date: July 9, 2005 at 21:50:13 Pacific
OS: Windows 2000
CPU/Ram: 512
Comment:

Does anyone know how to delete registry hive through vbscript?

Set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.RegDelete "HKCU\Myhive\"

I keep getting error indicate unable to remove key.



Sponsored Link
Ads by Google

Response Number 1
Name: Bryco
Date: July 10, 2005 at 03:39:30 Pacific
Reply:

You don't delete a key. You add a negative key. eg. -HKCU\Myhive\

To delete a value the minus sign comes after the value. eg. HKCU\Myhive\MyValue-

HTH
Bryan


0

Response Number 2
Name: aznkd74
Date: July 10, 2005 at 18:15:35 Pacific
Reply:

In vbscript, you can't use a negative to registry hive. I have tried and argument is invalid. I am trying to delete a whole registry hive not just one key. I read somewhere where that vbscript is does not support reg delete of hive if the sub keys aren't empty. If this true, does anyone know a whay around. I tried a batch file with the /f but it still prompts when it is executed. I want it to be transparent to user end when it is ran with no user intervention.


0

Response Number 3
Name: Bryco
Date: July 11, 2005 at 02:24:59 Pacific
Reply:

How about regedt32.exe /s [-HKCU\Myhive]

I really don't know the answer but trying to lend assistance. I do not know the inner workings of vbscript.

If no go then I will back off,
Bryan


0

Response Number 4
Name: aznkd74
Date: July 11, 2005 at 18:12:03 Pacific
Reply:

Bryan,

Much appreciation for your assistance. But how can I incorporate that command structure in vbs?

'Delete CCTP registry hive
Set WshShell = CreateObject("WScript.Shell")
WshShell.RegDelete "HKCU\Software\Myhive"

Are you talking about running that command through a batch file? If you are then I can accomplish that through a batch, but it still require user intervention for the batch to proceed with the deletion of the hive.


0

Response Number 5
Name: Bryco
Date: July 12, 2005 at 02:19:27 Pacific
Reply:

According to the follwoing article it is possible to import the -reg file by running it from a batch file in silent mode:

http://www.winguides.com/article.php?id=1&page=4&guide=registry

HTH
Bryan


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon

Copying Files to 5 Drives internet sharing



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Windows 2000 Forum Home


Sponsored links

Ads by Google


Results for: vbscript RegDelete hive problem

Registry can't load hive file...help! www.computing.net/answers/windows-2000/registry-cant-load-hive-filehelp/11640.html

Registry Problem. Help??? www.computing.net/answers/windows-2000/registry-problem-help/8602.html

System Hive corrupt. www.computing.net/answers/windows-2000/system-hive-corrupt/41927.html