See more articles about "Batch File Programming "

Create Batch File to Start or End Window Services

 

The windows environment can be easily changed by starting or ending various windows services. For example, this method can be used to easily shut down multiple services for a performance boost during game playing.

Warning: Manipulating windows services can have unpredictable effects on your system. You should create a system restore point before experimenting.



We all want to tweak or windows systems to the extreme to get the quickest, most powerful system possible. Many people will disable multiple window services manually before game playing. What a pain!



Many times people forget what the services do or forget to restart the important ones. Services can be easily changed by creating batch files.



The important commands are the following:

NET START - starts the service

NET STOP - ends the service



For example:

NET STOP "Error Reporting Service"



Output: The Error Reporting Service service was stopped successfully.



Knowing the commands, one can now easily create batch files called something like beforegame.bat and aftergame.bat.



Before.bat would contain all the NET STOP commands to end the nonessential services.

After.bat would be exactly the same except all the NET STOP commands would be replaced with NET START commands to restart all the common services.



A sample of the before.bat file might look something like this:



NET STOP "Error Reporting Service"

NET STOP "FTP Publishing Service"

SET STOP "IIS Admin"

NET STOP "Messenger"





Likewise, the after.bat file might look something like this:



NET START "Error Reporting Service"

NET START "FTP Publishing Service"

SET START "IIS Admin"

NET START "Messenger"





You may wish to reference this: list of services that can be disabled.



If your system ever becomes unstable and you want to return the services to their default settings, the default settings for the windows services can be found here.

 

Also see ...

Supressing Prompts In Batch Files While Deleting All Files
H3Successful batch files cannot be slowed down with a bunch of user prompts. This little recipe will show you how to supress prompts in batch files./H3PCommands such as deleting all files can complicate batch files because the system prompts for confirmation. For example... br / br /spa

Supress Responses From Commands In Batch Files
H3This quick recipe describes how to supress responses to commands within batch files./H3PDuring the execution of your batch files, users can see your commands on the screen. Most of the time this is good for debugging purposes; however, often it's better to run your batch file silently. br

Processing the contents of a text file using FOR loop
H3As admins, we often have to take actions against a list of things (computers, servers, file shares, etc). One great way to approach this is to put the list in a test file and use a FOR command to loop through the file and take a action against the contents./H3PSay we have a file full of com

Using variables in Windows batch files
H3Regardless of the scripting language, the use of variables can greatly enhance the functionality of a script. This recipe demonstrated basic use of variables in MS DOS or Windows batch files./H3PThe following script demonstrates a trivial example of setting a variable and displaying it: br