Widget powered by WhatstheScore.com

Author Topic: How to Create an Easy Windows Batch File  (Read 292 times)

0 Members and 1 Guest are viewing this topic.

Offline internet police

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1314
    • View Profile
How to Create an Easy Windows Batch File
« on: July 06, 2015, 09:43:27 PM »
The first method of using a computer wasn?t through voice commands, touch-sensitive screens or even a mouse. In fact, it wasn?t quite accessible and you?d need a lot of ambition and patience to learn how to use one, because almost everything relied on code.

It doesn?t mean that coding is obsolete, now that every application and game looks so good and you hardly depend on any kind of text. On the contrary, coding still remains the building blocks of any program and game, with a large variety and languages to use.

In case you were ever wondering why Microsoft didn?t get rid of the Notepad, its basic text editor, then you might want to know that it can be used to create simple, or extremely complex Batch programs. With a little research, you can find multiple ways to use a plain text file to enhance your everyday computer activities. Below you find several commands and how they can be used.
Making a simple Batch file

Step 1: Right-click the desktop and choose to create a New Text Document. It needs to be a plain text file, not RTF or any Office formats.

Step 2: Do a little research on what commands you need, and most of all, what you want the new Batch program to do.

Note: Following these steps only creates a simple program that displays some text.

Step 3: Write down @ECHO OFF so that the code is not displayed in the final form.

Step 4: Press Enter to go to the second line, write ECHO then press space and add the information you want to be displayed.

Step 5: Go to the next line and write PAUSE just so the window stays up until user input. Otherwise, the window shows up for a second and closes automatically.

Step 6: Under the File menu, choose to Save As.

Step 7: Change the Save As Type to All Files from the corresponding drop down menu.

Step 8: Give the program a name and the .BAT extension.

Displaying text is not the only thing you can do with a Batch file. It all depends on how you combine functions. Some cases require heavy logic and use of special operators, and it?s probably the way you find out math is useful. As Wikipedia states, these are the available DOS commands, which can be used, since a Batch file is nothing more than a DOS script.
List of Batch commands
APPEND    Set or display search path for files.
ASSIGN    The command redirects requests for disk operations on one drive to a different drive. It can also display drive assignments or reset all drive letters to their original assignments.
ATTRIB    Change or view attributes of one or more files.
BACKUP and RESTORE    Original commands to backup and restore files. Replaced later on by CPBACKUP or MSBACKUP
CALL    Invokes a Batch program from another Batch program
CHCP    Displays or changes the active code page used to display character glyphs in a console window.
CHKDSK    Checks a specific storage volume.
CHOICE    Prompts user to choose from several options.
CLS    Clears the terminal screen.
COPY    Copies files to a specific location.
DATE    Displays system date.
DEL and ERASE    Delete one or more files.
DIR    Shows contents of a directory.
ECHO    Displays text on screen.
EXIT    Closes the program.
FC and COMP    Compares two files and shows differences.
FOR    A loop syntax based on a set of conditions.
MD or MKDIR    Creates a new directory.
MOVE    Moves files to a specific location.
PATH    Displays or sets a search path for executable files.
PAUSE    Suspends all activity until user input.
RD and RMDIR    Removes a directory.
REM    Adds comment without any action.
REN    Renames a file.
SORT    Filters input data and sends it to output data stream.
TIME    Displays system time.
TITLE    Modifies the program title (shown in title bar).
UNDELETE    Restores files deleted with the DEL command
XCOPY    Copies entire directory tree.

This is not the complete set of supported commands. you can do more research for more.


How to free up space on PC by Finding and removing Large unused Files in Windows

Started by admin

Replies: 0
Views: 307
Last post September 12, 2015, 05:44:29 PM
by admin
How to Install Android Applications on New Windows 10 Mobile Devices

Started by admin

Replies: 0
Views: 407
Last post August 09, 2015, 10:21:08 AM
by admin
How to Make Windows 10 Start Menu runs Faster

Started by mastercode

Replies: 0
Views: 405
Last post September 01, 2015, 06:36:11 PM
by mastercode
How to Monitor and Track All System Change in Windows on your PC

Started by internet police

Replies: 0
Views: 199
Last post September 30, 2015, 11:38:19 PM
by internet police
How to fix Windows 10 internet connection common Problems

Started by yungcrux

Replies: 0
Views: 154
Last post August 22, 2016, 08:42:35 AM
by yungcrux