64,680
社区成员
发帖
与我相关
我的任务
分享
set objshell=createobject("wscript.shell")
objshell.run("%comspec% /k netsh int ip set dns 本地连接 static xxx.xxx.xxx.xxx primary"),0,true
CString strShellCmd = _T("netsh interface ip set dnsservers "无线网络连接" static 208.67.222.222");
SHELLEXECUTEINFO ExeInfo;
ZeroMemory(&ExeInfo, sizeof(SHELLEXECUTEINFO));
ExeInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ExeInfo.lpFile = _T("cmd.exe");
ExeInfo.lpParameters = strShellCmd;
ExeInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ExeInfo.nShow = SW_HIDE;
ExeInfo.hwnd = NULL;
ExeInfo.lpVerb = _T("runas");
ExeInfo.lpDirectory = NULL;
ExeInfo.hInstApp = NULL;
//执行命令
BOOL nret = ShellExecuteEx(&ExeInfo);
CString strExit(_T("/c exit"));
ExeInfo.lpParameters = strExit;
nret = ShellExecuteEx(&ExeInfo);
这就是那个修改DNS的代码