110,566
社区成员
发帖
与我相关
我的任务
分享
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\QQ]
@="QQ"
"URL Protocol"="F:\\QQ\\QQ.exe"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\QQ\DefaultIcon]
@="%SystemRoot%\\system32\\url.dll,0"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\QQ\Shell]
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\QQ\Shell\open]
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\QQ\Shell\open\command]
@="F:\\QQ\\QQ.exe"
<A href='QQ://a'>test</A>
public string ExeCommand(string commandText)
{
Process p = new Process();
p.StartInfo.FileName = "cmd.exe"; //换成你要执行的
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
string strOutput = null;
try
{
p.Start();
p.StandardInput.WriteLine(commandText);
p.StandardInput.WriteLine("exit");
strOutput = p.StandardOutput.ReadToEnd();
p.WaitForExit();
p.Close();
}
catch (Exception e)
{
strOutput = e.Message;
}
return strOutput;
}
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>js操作注册表</title>
<script language="javascript">
var shell = new ActiveXObject("WScript.Shell");
function read()
{
//读注册表值
var key1= shell.RegRead("HKEY_CURRENT_USER\\Test\\hello");
window.alert(key1);
}
function del()
{
//删除注册表项
shell.RegDelete("HKEY_CURRENT_USER\\Test\\hello");
alert("写入成功");
}
function writen()
{
//往注册表中写入值
shell.RegWrite ("HKEY_CURRENT_USER\\Test\\hello","柳晛","REG_SZ");
alert("写入成功")
}
</script>
</head>
<body>
<form name="form1" method="post" action="">
<label>
<input type="button" name="btn1" value="读取" onClick="read()">
<input type="button" name="btn2" value="删除" onClick="del()">
<input type="button" name="btn3" value="写入" onClick="writen()">
</label>
</form>
</body>
</html>