显示运行对话框内保存的命令历史的vbs
2016-07-20来源:

这段代码可以获取曾经在运行对话框中的,我们之前输入的命令历史

代码如下:

Const HKEY_CURRENT_USER = &H80000001

strComputer = "."

Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")

strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU"

objRegistry.EnumValues HKEY_CURRENT_USER, strKeyPath, arrValueNames, arrValueTypes

For Each strValue in arrValueNames

If Len(strValue) = 1 Then

objRegistry.GetStringValue HKEY_CURRENT_USER,strKeyPath,strValue,strRunCommand

intLength = Len(strRunCommand)

strRunCommand = Left(strRunCommand, intLength - 2)

Wscript.Echo strRunCommand

End If

Next

推荐信息
Baidu
map