我需要一个Windows激活方法。我的代码有效,但它创建了一个弹出窗口,我不想要它 有没有办法在没有任何消息的情况下在后台激活?
private void tryingActivateWindows()
{
ProcessStartInfo psi = new ProcessStartInfo("cmd", "/c " + "SLMGR -ato");
psi.UseShellExecute = false;
psi.CreateNoWindow = true;
Process p = new Process();
p.StartInfo = psi;
p.Start();
p.WaitForExit();
}
答案 0 :(得分:1)
运行"cscript C:\Windows\System32\slmgr.vbs /ato"
它会阻止弹出窗口。
答案 1 :(得分:1)
private void tryingActivateWindows()
{
Process activateScript = new Process();
activateScript.StartInfo.FileName = @"cscript";
activateScript.StartInfo.WorkingDirectory = @"C:\Windows\System32\";
activateScript.StartInfo.Arguments = "//B //Nologo slmgr.vbs -ato";
activateScript.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
activateScript.Start();
activateScript.WaitForExit();
}