比如当前用户为一个user,我要双击程序文件,让程序自动以administrator身份打开运行。我有administrator的密码,怎么做?急!!!!

解决方案 »

  1.   

    你可以使用runas命令,或者建立一个快捷方式,在属性中指定以其他用户运行
      

  2.   

    runas命令?在c#程序里怎么写啊?
      

  3.   

    string sUsername = "user";
                string sPassword = "123";            Process updateProcess = new Process();
                //updateProcess.StartInfo.ErrorDialog = false;
                updateProcess.StartInfo.UseShellExecute = false;
                updateProcess.StartInfo.RedirectStandardOutput = true;            updateProcess.StartInfo.UserName = sUsername;
                SecureString password = new SecureString();
                for (int i = 0; i < sPassword.Length; i++)
                {
                    password.AppendChar(sPassword[i]);
                }            updateProcess.StartInfo.Password = password;            updateProcess.StartInfo.FileName = @"d:\test\update\update.bat";
                updateProcess.StartInfo.WorkingDirectory = @"d:\test\update";            updateProcess.Start();
      

  4.   

    runas tool
    http://www.szuon.cn/files/RunAs%20Tool%20V1.1.ziphttp://www.szuon.cn/RunAs%20tool.html