MS SQL Server command line mode startup, close

xiaoxiao2021-03-06  40

Forces, SQL Server installation is the default name Bool StartMssqlserver () {process_information pi = {0}; startupinfo si = {0}; Bool Bsuccess = false; bsuCcess = CreateProcess (Null, "SCM-Silent 1 -Action 1 -Service MSSQLSERVER ", NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, & SI, / / ​​Returned Handle & Pi);

IF (bsuccess) {closehandle (pi.hthread);

// Wait for the process to end if the process ends IF (WaitForsingleObject (infinite) == Wait_failed) {bsuccess = false;}

CloseHandle (pi.hprocess);

return bSuccess;} static BOOL CloseMsSqlServer () {PROCESS_INFORMATION pi = {0}; STARTUPINFO si = {0}; BOOL bSuccess = FALSE; bSuccess = CreateProcess (NULL, "scm -Silent 1 -Action 6 -Service mssqlserver", NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, & SI, / / ​​The structure of the structure has a process in the structure;

IF (bsuccess) {closehandle (pi.hthread);

// Wait for the process to end if the process ends IF (WaitForsingleObject (infinite) == Wait_failed) {bsuccess = false;}

CloseHandle (pi.hprocess);

Return bsuCcess;}

转载请注明原文地址:https://www.9cbs.com/read-76052.html

New Post(0)