

InterviewSolution
Saved Bookmarks
1. |
Solve : How to change Start type in services using batch file.? |
Answer» <html><body><p>Hi Everyone:<br/>I Know how to stop service using batch file,<br/><br/> Code: <a>[Select]</a>NET STOP "<a href="https://interviewquestions.tuteehub.com/tag/ipod-1035236" style="font-weight:bold;" target="_blank" title="Click to know more about IPOD">IPOD</a> Service"<br/>but I don't know yet how to change Start type from <strong>Automatic </strong> to <strong><a href="https://interviewquestions.tuteehub.com/tag/manual-247374" style="font-weight:bold;" target="_blank" title="Click to know more about MANUAL">MANUAL</a></strong> using batch.<br/>Could you give me advice, please?<br/><br/><br/>I am not aware of anyway to do this with batch code, but you can create a VBScript and have it run from the command prompt:<br/><br/> Code: <a>[Select]</a>strComputer = "."<br/>Set objWMIService = GetObject("winmgmts:" _<br/> & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")<br/><br/>Set colListOfServices = objWMIService.ExecQuery _<br/> ("Select * from Win32_Service Where Name = 'iPod Service'")<br/><br/>For Each objService in colListOfServices<br/> rc = objService.Change( , , , , "Manual") <br/>Next<br/><br/>Save the script with a <strong>VBS</strong> extension. Run from the command line as: <strong><a href="https://interviewquestions.tuteehub.com/tag/cscript" style="font-weight:bold;" target="_blank" title="Click to know more about CSCRIPT">CSCRIPT</a> <em>scriptname.vbs</em></strong><br/><br/>Good <a href="https://interviewquestions.tuteehub.com/tag/luck-1081575" style="font-weight:bold;" target="_blank" title="Click to know more about LUCK">LUCK</a>. Type sc /? at a command prompt<br/><br/>or<br/><br/>Check this link:<br/><a href="https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/sc.mspx?mfr=true">http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/sc.mspx?mfr=true</a><br/><br/></p></body></html> | |