Archive for the 'Uncategorized' Category

How to exit a Windows MS-DOS window through a batch file

When a batch file is complete, Microsoft Windows will leave the Window open, requiring the user of the computer to manually close it. For convenience, the individual [...]

How to create a blank line in a batch file

It may be necessary to create a blank line to help separate text from other text or move text further down the screen.
To create a line add a dot or period [...]

How to execute commands in a batch file in timed intervals

In the below example, the batch file is placed into a loop  and executes the “dir” command every 20 seconds. This solution would be best for users who need to execute a command frequently.
:START
REM Execute the MS-DOS dir command ever 20 seconds.
dir
SLEEP 20
GOTO END
Note: In order for the above batch file to run properly you [...]

Prevent deleting files in MS-DOS without a prompt

To help prevent files from becoming accidentally deleted Microsoft will warn you before deleting files or folders.
By default Microsoft Windows will not prompt a user [...]

How to make a time log in a batch file

The below example demonstrates how to create a time log of when the batch file is loaded, or for example, this could be used in the autoexec.bat when someone logs into a computer that supports this file.
ECHO. |TIME > TIME
COPY LOG +TIME

An alternate, slightly more complicated method that, to our knowledge, cannot be used in [...]

Creating a batch file delay

Below is an example of how to delay a batch file any where from 5 to 99 seconds. In the below example we illustrate a 5 second delay.
TYPE NUL | CHOICE.COM /N /CY /TY,5 >NUL

How to start Windows files and other programs from a batch file

To run Microsoft Windows programs or files use the START command. The below example would run Windows Notepad.
START /MAX NOTEPAD
You can also specify the direct location of the file by typing the below command.
START /MAX C:\Windows\NOTEPAD.EXE
*Windows users who have a different directory (e.g. Windows 2000 users) would need to substitute WINNT or the name of [...]

What is batch file?

A batch file is a text file with a .bat or .cmd extension. A batch file adheres to a syntax and a set of valid commands or instructions. To run a batch file, enter the file’s name. You don’t need to enter the .cmd or .bat extension. To write a basic batch file, perform the [...]