BleepingComputer.com: Script for Deleting files/reg keys

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Script for Deleting files/reg keys

#1 User is offline   Illegal Alien 

  • Member
  • PipPip
  • Find Topics
  • Group: Members
  • Posts: 33
  • Joined: 03-August 08

Posted 10 October 2008 - 07:43 PM

I want to make a script that will delete Registry Keys using wildcards, such as HKEY_CURRENT_USER\test00*. It also has to be able to delete specific files using environment variables such as %appdata% or %homedrive%.

what scripting language would be best to use? Autohotkey(AutoIt), VBS, batch? Any help please. Also, a good source of info for the selected language would be nice too.

#2 User is offline   groovicus 

  • Hail Groovicus!
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Moderator
  • Posts: 9,605
  • Joined: 05-June 04
  • Gender:Male
  • Location:Centerville, SD

Posted 10 October 2008 - 07:53 PM

What do you mean by best? There are any number of scripting languages that would work equally well.
"Take the risk of thinking for yourself, much more happiness, truth, beauty, and wisdom will come to you that way" - Christopher Hitchens

#3 User is offline   PlyPencil 

  • Member
  • PipPip
  • Find Topics
  • Group: Members
  • Posts: 51
  • Joined: 26-September 08

Posted 11 October 2008 - 02:50 AM

Visual Basic is an EASY language which is easy to pick up and is extremely simple to delete a registry key.

Get Value
Sub Main()

		If My.Computer.Registry.GetValue("HKEY_CURRENT_USER\software\microsoft\windows\currentversion\policies\system\", _
		"TestValue", Nothing) Is Nothing Then
			MsgBox("Value does not exist.")
		End If

threading.thread.sleep(10000)

End Sub


(keyName as string, Value Name, DefaultValue) is string




Environment Variables
		My.Computer.Registry.LocalMachine
		My.Computer.Registry.Users
		My.Computer.Registry.PerformanceData
		My.Computer.Registry.ClassesData
		My.Computer.Registry.CurrentConfig
		My.Computer.Registry.DynData
		My.Computer.Registry.ClassesData




Delete Value
Sub Main()

		My.Computer.Registry.LocalMachine.DeleteValue(name as string)
		My.Computer.Registry.LocalMachine.DeleteSubKey(subkey as string)
		My.Computer.Registry.LocalMachine.DeleteSubKeyTree(subkey as string)

threading.thread.sleep(10000)

End Sub


Hope this helps,

Ply.

This post has been edited by PlyPencil: 11 October 2008 - 02:58 AM


Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users