DosTips.com

A Forum all about DOS Batch
It is currently 25 Sep 2016 04:34

All times are UTC-06:00




Post new topic  Reply to topic  [ 18 posts ]  Go to page Previous 1 2
Author Message
PostPosted: 10 Aug 2012 11:17 
Offline

Joined: 25 May 2012 12:34
Posts: 20
Liviu,
That seem to work well.
I put some pauses in it so I can see it as it works. Is there a way to >> push the disabled ones into a text file, then start disabled.txt
I want to stop those currently running, and disable them from restarting. Of course I will need to list AV services as to not disable them, but if they are any good, they don't allow that (which is a test I want)

So currently this code only stops those stoppable but does it disable all those not in the list?
This is why I was shooting for just stopping and disabling anything not in the list. I wouldn't use this on computers with specialized services of course.
By the way, thank you for your help. Please understand, these are the services I would be turning off anyway, just more automated.


Top
   
PostPosted: 10 Aug 2012 13:30 
Offline
Expert

Joined: 13 Jan 2012 21:24
Posts: 469
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


Top
   
PostPosted: 19 Dec 2015 12:55 
Offline

Joined: 25 May 2012 12:34
Posts: 20
To complete this topic, I created a batch that disables all but a few necessary services. It is similar to safe mode. It has been a great success and allows us to install programs to scan. An alternative we have found was a little utility that enabled services in safe mode to allow installations.
We also use a similar batch to disable multiple services that really increase the computers speed. Thanks all for the help.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 18 posts ]  Go to page Previous 1 2

All times are UTC-06:00


Who is online

Users browsing this forum: Bing [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited