A batch file is a text file containing a series of commands intended to be executed by the command interpreter. Batch files were added to ease the work required for certain regular tasks by allowing the user to set up a batch script to automate many commands.DOS batch files have the filename extension .bat. Batch files for other environments may have different extensions, e.g. .cmd.
In this tutorial of "Tweaky Scripts" we will create a batch file to tweak the registry so the following tasks can be done:
- Hiding all drives
- Preventing access to drives
- Turning off autoplay
- Turning off automatic updates
- Restoring all to default
Before proceeding download batch script from here.
or create it by yourself by opening the Notepad and and pasting the following code and changing the extension of text file to .bat.
In first line of code you will see "@echo off" because of which commands will not be displayed while executing, you can set it to "on" if you want to display commands while executing.
Echo command is also used to display messages.
Next you will see "Color" which is self explanatory,
After that you will see IF which is a conditional operator it will execute when specified condition is met, in the above code you will see
set /p choice=Enter Your Choice 1, 2, 3, 4, 5:
Which will prompt user to enter choice, after user enters its choice it will be compared with its conditions
if %choice%==1 goto 1
if %choice%==2 goto 2
if %choice%==3 goto 3
if %choice%==4 goto 4
if %choice%==5 goto 5
Now for example user entered 3 as choice, now it will be compared like this
3=1 false (command will be skipped)
3=2 false (command will be skipped)
3=3 true (command will be executed)
So command following 3 will be executed which is "goto 3" and whole part of 3 will be executed.
For 5 different condition we have created 5 different blocks. Each bloch can have its its own code.
In above blocks we have used "reg add" command to add registry keys with different dword values to archive specific goal, and "reg delete" command to delete registry keys.
For more information type reg/? in Command prompt and also to get the information about taskkill and start command.
In case you feel any difficulty in implementing feel free to comment.
- Some Useful Greasemonkey Scripts For Facebook
- Making a Batch File For Disk Management
- Customizing Windows XP's General Tab
- Creating Windows Based Scripts