
Re: Stopping services, restarting services(safemode)
crobertson wrote:
Is there a way to >> push the disabled ones into a text file
Assuming you mean "stopped" rather than "disabled", yes, all you need to do is add a line "if exist disabled.txt del disabled.txt" before the top for loop, then right after "net stop" insert a line "echo %svcex%>>disabled.txt".
crobertson wrote:
then start disabled.txt
Code:
for /f "delims=" %%x in (disabled.txt) do @echo net start "%%x"
crobertson wrote:
So currently this code only stops those stoppable but does it disable all those not in the list?
Only stops, the disabling part popped up later in the thread. If you really have to do that, lookup "sc config start=".
crobertson wrote:
Please understand, these are the services I would be turning off anyway, just more automated.
Just as a note, even the "turning off" part is not guaranteed to always work, and can't be made to work reliably using a simplistic batch+whitelist solution. For example, it is technically possible that the next millisecond after you "net stop" a service, another service which comes later in the alphabetical list (and has not been stopped yet) needs the first service and restarts it manually.
Liviu