Batch Files: Batch files came into notice when Microsoft Windows was introduced in 1985 and had a GUI OS/Interface. Before then, batch file...

Batch Files:
Batch files came into notice when Microsoft Windows was introduced in 1985 and had a GUI OS/Interface. Before then, batch files were widely used to run earlier operating systems but were never recognized. Batch files back then could be executed by the Command Line Interpreter (CLI) COMMAND.COM. All operating systems before that had a text-based operating system and were designed to run on MS-DOS. Batch files significantly helped Windows operating systems. A batch file named AUTOEXEC.BAT was responsible for the automatic loading of Windows on the early versions of these operating systems.

Windows batch files were used crucially in these operating systems mainly:

Windows 1
Windows 2
Windows 3
Windows 95
Windows 98
Windows ME

Batch files are still used as crucial bits in Windows but not as much. Yes, all this does sound confusing.
But all you need to know is that batch files originated in early versions of Windows and performed many crucial tasks on these early operating systems.

What can batch scripts be used for?

It can be used for various tasks regarding the Windows operating systems. For example, it can be used to delete files,
change attributes, remove directories, edit the registry, modify services, and many other things.
It is very simple to learn and it can be very beneficial for anyone to know that uses Windows.

Creating Batch files: 
Well batch files can be created by using simple text editors (such as notepad). All you need to do is save your file as one of these extensions:

This is the first ever extension made for batch files. This extension is compatible with all versions of windows.

This extension is mainly used by operating systems in Windows NT family.

This is the extension that is used by 4DOS and 4NT. It was previously used for faster compilation sequences.

Can I make viruses with batch?
The answer is no. Anyone claiming to doesn't fully understand a virus.
Viruses are very complex and are coded in things like C++ and Assembly.
Viruses are self-replicating malware that is created for the sole purpose of damage and theft of information.
Things coded in batch that are claimed to be malware normally are scripts that are added to start-up and
perform reboot loops, flooding hard drive so it will run out of space, performing a loop that opens
command lines causing the computer to freeze, and things of that sort.

Batch Commands:

Open up Command Prompt and type "help" without quotes, then hit enter. It will show a list of commands and a description of each.

I have provided a list of the commands and their description. I have also added a few more commands that aren't listed. I created this list a while back.

To get more information about a command or to get its usage instructions, then type the command with "/?" without quotes at the end.

For example, "reg /?" without quotes.

Assoc - Displays or modifies file extension associations.
Attrib - Displays or changes file attributes.
Bootcfg - Used to configure, query, change or delete the boot entry settings in the boot.ini file.
Break - Sets or clears extended CTRL+C checking.
Bcdedit - Sets properties in boot database to control boot loading.
Cacls - Displays or modifies access control lists (ACLs) of files.
Call - Call one batch program from another
CD - Change Directory - Changes the directory it reads from or displays the name of the current directory.
Chkdsk - Checks a disk and displays statusreport.
Chkntfs - Check the NTFS file system
Choice - Allows uses to select one item from a list of choices and returns the index of the selected choice.
Cipher - Displays or alters the encryption of directories on NTFS paritions.
CleanMgr- Automated cleanup of Temp files, recycle bins, etc.
Cls - Clears the screen.
Cmd - Starts a new instance of the Windows command interpreter.
Cmdkey - Creates, displays, and deletes stored user names and passwords.
Color - Sets the default console foreground and backgroup colors.
Comp - Compares the contents of two files or sets of files.
Compact - Displays or alters the compression of files on NTFS partitions.
Convert - Converts FAT volumes to NTFS.
Copy - Copies one or more files to another location.
Date - Displays or sets the date.
Defrag - Defragments the hard drive.
Del - Deletes one or more files.
Dir - Displays a list of files and folders.
Diskcomp - Compare the contents of one floppy disk to another.
Diskpart - Displays or configures disk partition properties.
Doskey - Edits command lines, recalls Windows commands, and creates macros.
Driverquery - Displays current device driver status and properties.
Echo - Displays messages, or turns command echoing on or off.
Endlocal - End localisation of environment changes in a batch files.
Erase - Deletes one or more files.
Eventcreate - Add a message to the Windows event log.
Exit - Exits Command Prompt.
Expand- Expands one or more compressed files.
FC - Compares two files.
Find - Searches for a text string in a file or files.
Findstr - searches for strings in files.
For - Runs a specified command for each file in a set of files.
Forfiles - Selects a file, or set of files, and executes a command on that file.
Format - Formats a disk for use with Windows.
Fsutil - Displays or configures the file system properties.
Ftp - Transfers files to and from a romcputer running an FTP server service.
Ftype - Displays or modifies file types used in file extension associations.
Goto - Directs the Windows command interpreter to a labeled line in a batch program.
Gpupdate - Updates group policies settings.
Graftabl - Enables Windows to display an extended character set in graphics mode.
Help - Provides help information for Windows commands.
Icacls - Display, modify, backup, or restore ACLs for files and directories.
If - Performs conditional processing in batch programs.
Ipconfig - IP configuration.
Label - Creates, changes, or deletes the volume label of a disk.
MD - Creates a directory.
MKDir - Creates a directory
Mklink - Creates a symbolic link.
Mode - Configures a system device.
More - Displays output one screen at a time.
Mountvol - Creates, deletes, or lists a volume mount point.
Move - Moves one or more files from one directory to another directory.
Msg - Send a message to a user.
Msiexec - Microsoft Windows Installer.
Mstsc - Remote Desktop
Net - Manage network resources
Netsh - Configure network interfaces.
Nbtstat - Displays protocol statistics and current TCP/IP connections using NBT.
Netstat - Displays protocol statistics and current TCP/IP network connections.
Nslookup - Name server lookup
Openfiles - Displays files opened by remote users for a file share.
Path - Displays or sets a search path for executable files.
Pathping - Trace route plus network latency and packet loss.
Pause - Suspends processing of a batch file and displays a message.
Perfmon - Performance monitor
Ping - Test a network connection
Popd - Restores the previous value of the current directory saved by PUSHD.
Powercfg - Configures power settings.
Print - Prints a text file.
Prompt- Changes the Windows command prompt.
Pushd - Saves the current directory then changes it.
Rasdial - Manage RAS connections
Rasphone - Manage RAS connections
RD - Removes a directory (folder).
Recover - Recovers readable information from a bad or defective disk.
Reg - Registry: Read, set, export, delete, and add keys and values.
Regedit - Import or export registry settings.
Regsvr32 - Register or unregister a DLL.
Regini - Change Registry permissions.
REM - Records comments in batch files.
REN - Renames a file or files.
Rename - Renames a file or files.
Replace - Replaces files.
RMDIR - Removes a directory (folder).
Robocopy - Advanced utility to copy files and directory trees.
Route - Manipulate network routing tables.
RunAs - Executes a program uder a different user account.
Rundll32 - Runs a DLL command.
SC - Displays or configures services.
Schtasks - Schedules a command to run at a specific time.
Set - Displays, sets, or removes Windows environment variables.
Setlocal - Begins localization of environment changes in a batch file.
Setx - Set environment variables permanently.
SFC - System File Checker
Shift - Shifts the position of replaceable parameters in batch files.
Shutdown - Allows proper local or remote shutdown of machine.
Slmgr - Software Licensing Management
Sort - Sorts input.
Start - Starts a separate window to run a specified program or command.
Subst - Associates a path with a drive letter.
Systeminfo - Displays machine specific properties and configuration.
TaskList - Displays all currently running tasks including services.
Taskkill - Kill or stop a running process or application.
Time - Displays or sets the system time.
Timeout - Delay processing of a batch file.
Title - Sets the window title for a batch file.
Tracert - Trace route to a remote host.
Tree - Graphically displays the directory structure of a drive or path.
Type - Displays the contents of a text file.
Typeperf - Write performance data to a log file.
Ver - Displays the Windows version.
Verify - Tells Windows whether to verify that your files are written correctly to a disk.
Vol - Display a disk volume label and serial number.
Where - Locate and display files in a directory tree.
Whoami - Output the current Username and domain.
WMIC - WMI commands.
Wuauclt - Windows Update

Color Codes:

These are used to change the color of the GUI. Not required, but they make the Black and White command prompt look better.
I prefer light yellow text on a light red background.

0 = Black
1 = Blue
2 = Green
3 = Aqua
4 = Red
5 = Purple
6 = Yellow
7 = White
8 = Gray
9 = Light Blue
A = Light Green
B = Light Aqua
C = Light Red
D = Light Purple
E = Light Yellow
F = Bright White

To view the list of colors in your cmd prompt,
1)Open your cmd prompt and just type "help color"(without the quotes),
2)Help with a list of the colors available will show up,
3)The list will show numbers from 0 to 9 and letters from A to F.

Type 'color 6' to have yellow text, 'color 4' to have red text, 'color A' to have light green text etc. ( Ignore all quotes )
To change the color of the text as well as the background, type 'color ce' ( without the quotes )
to have light yellow text on a light red background or any other combination.
The first letter/number is the color of the background and the second is the color of the text.

Post a Comment


Home item

Follow by Email

Recommend on Google



Popular Posts

Random Posts

Recent Posts


eXTReMe Tracker