Kelsenellenelvian Posted November 4, 2007 Posted November 4, 2007 OKAY here is the reg key:[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]"WPI"=-NOTE This is DELETING the sub-key of WPI.Now the issue is I can get it to delete the whole run section (Not very good) But not just the sub-key.I have the function DeleteRunEntry built in that will call this function I just need the javascript to delete a sub-key.ANY IDEAS?
newbie1 Posted November 4, 2007 Posted November 4, 2007 hi kelsenellenelviani think that this is the answer to your post (i hope) Deleting Registry Keys and ValuesTo delete a registry key with a .reg file, put a hyphen (-) in front of the RegistryPath in the .reg file. For example, to delete the Test subkey from the following registry key:HKEY_LOCAL_MACHINE\Softwareput a hyphen in front of the following registry key in the .reg file: HKEY_LOCAL_MACHINE\Software\TestThe following example has a .reg file that can perform this task. [-HKEY_LOCAL_MACHINE\Software\Test]To delete a registry value with a .reg file, put a hyphen (-) after the equals sign following the DataItemName in the .reg file. For example, to delete the TestValue registry value from the following registry key:HKEY_LOCAL_MACHINE\Software\Testput a hyphen after the "TestValue"= in the .reg file. The following example has a .reg file that can perform this task. HKEY_LOCAL_MACHINE\Software\Test"TestValue"=- To create the .reg file, use Regedit.exe to export the registry key that you want to delete, and then use Notepad to edit the .reg file and insert the hyphen. the full link is http://support.microsoft.com/kb/310516/en-us newbie1
Yzöwl Posted November 4, 2007 Posted November 4, 2007 OKAY here is the reg key:var WshShell = WScript.CreateObject("WScript.Shell");gVal = "HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\WPI";try{ WshShell.RegDelete(gVal); }catch(e){ var sTest = e.description.substr(0,7); if(sTest=="Unable "){ WshShell.Popup("value does not exist"); } else { if(sTest=="Invalid"){ WshShell.Popup("key does not exist"); } else { WshShell.Popup(e.description); } } }
Kelsenellenelvian Posted November 5, 2007 Author Posted November 5, 2007 OKAY Here is the idea I have (Let me try to clarify it better.)In the options installer tab I added a function called "Deleterunentry" I added this entry because I want users to be able to have WPI load AFTER the desktop has loaded BUT to do this i need to add WPI to the run list like a regular prog. However I don't think we really need to make WPI load everytime a user reboots *silly*. Now the problem is I need the installer.hta to delete the entry on the beggining of the installation process but only if the user has selected this option in the options menu.SO it needs to be: (In installer.hta like so)<script type="text/javascript"> if (ResumeInstall)That deletes the key exactly as this regentry:Windows Registry Editor Version 5.00[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]"WPI"=-I have tried all I can think of and I am prolly just bein stupid.
lawrenca Posted November 5, 2007 Posted November 5, 2007 (edited) Kel,I'm hoping you are looking for something like this in java script:function Deleterunentry(){ position="api.js"; whatfunc="Deleterunentry()"; var wsh = new ActiveXObject("WScript.Shell"); try { wsh.RegDelete("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\WPI"); } catch (ex) {; } }Oops, Sorry about that Yzöwl, didn't look through the dropdown .js section of your code well enough...that was where I was going. Kel, did Yzöwl's code not help? Edited November 5, 2007 by lawrenca
Kelsenellenelvian Posted November 6, 2007 Author Posted November 6, 2007 YGPM Lawrenca naw I am really missing something.
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now