Bat starts the oracle local service, and bat starts the oracle service
Oracle local services are enabled by default, occupying computer resources, affecting the boot speed. It is cumbersome to enable and disable each time. The following is a one-click bat implementation, right-click, and run as administrator.
@ Echo off for/f "skip = 3 tokens = 4" % I in ('SC query OracleOraDb11g_home1TNSListener') do set "zt = % I" & goto: next: nextif/I "% zt %" = "RUNNING" (echo has found that the service is RUNNING and has stopped RUNNING. net stop OracleOraDb11g_home1TNSListener) else (echo: the service is stopped now, net start OracleOraDb11g_home1TNSListener will be started.) for/f "skip = 3 tokens = 4" % I in ('SC query OracleServiceORCL ') do set "zt = % I" & goto: next: nextif/I "% zt %" = "RUNNING" (echo has found that this service is RUNNING, net stop OracleServiceORCL) else (echo this service is stopped now and will start net start OracleServiceORCL): pause
Here, OracleOraDb11g_home1TNSListener and OracleServiceORCL are the names of the services you want to start (right-click the service-properties-service name)