#include <iostream>
#include <windows.h>
#include <ShellAPI.h>
int main()
{
SHELLEXECUTEINFO se;
memset(&se, 0, sizeof(SHELLEXECUTEINFO));
se.cbSize = sizeof(SHELLEXECUTEINFO);
se.lpVerb = L"runas";
se.lpFile = L"cmd.exe"; //要打开的进程路径
se.lpParameters = L"Administrator" //管理员权限
se.nShow = SW_HIDE;//打开的进程不显示界面
se.fMask = 0;//不要进程句柄
if(ShellExecuteEx(&se))
{
std::cout << "successfully"<<endl;
}
else
{
std::cout << "fail"<<endl;
}
return 0;
}