Read Reg Key – Output to text file

email me

This is how you would read a registry key, and then output the contents to a text file.

on error resume next

UTemp = ReadReg("HKLM\SOFTWARE\MyUserName\User Name")

Function ReadReg(RegPath)
Dim objRegistry, Key
Set objRegistry = CreateObject("Wscript.shell")
Key = objRegistry.RegRead(RegPath)
ReadReg = Key
End Function

If UTemp = "Administrator" then wscript.quit(0)

Set objShell = CreateObject("Wscript.Shell")
'msgbox UTemp
objShell.Run "%comspec% /c echo " & UTemp & ">un.dat",0,true