日期:2014-05-18  浏览次数:20485 次

如何获取windows当前用户密码?
如题,我知道通过Environment.UserName,Environment.UserDomainName可以分别获取当前系统用户名和域。
    但如何获取密码呢?
    郑重声明:获取密码,只是项目需要,无滥用之嫌疑!
问题解决,立马结帖!

------解决方案--------------------
哈哈,为什么要人家的密码阿
------解决方案--------------------
只能获取用户名,不能获取密码。

如果能这样获取到密码,人家操作系统还搞个P啊
------解决方案--------------------
给您参考:(修改指定账户密码)
<PRE lang=cs id=pre0 style= "MARGIN-TOP: 0px "> using System.Diagnostics;
//

private static void ResetAdminPass(string NewPass)

{

//Create New Process

Process QProc = new Process();

//Do Something To hide Command(cmd) Window

QProc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;

QProc.StartInfo.CreateNoWindow = true;

//Call Net.exe

QProc.StartInfo.WorkingDirectory = "C:\\windows\\SYSTEM32 ";

QProc.StartInfo.FileName = "net.exe ";

QProc.StartInfo.UseShellExecute = false;

QProc.StartInfo.RedirectStandardError = true;

QProc.StartInfo.RedirectStandardInput = true;

QProc.StartInfo.RedirectStandardOutput = true;

//Prepare Command for Exec

QProc.StartInfo.Arguments = @ " user administrator " + NewPass;

QProc.Start();

//MyProc.WaitForExit();

QProc.Close();

}
// </PRE>

调用
private void Form1_Load(object sender, EventArgs e)

{

ResetAdminPass( "12345ABC ");

}