Write your first .bat file

A script file or file.Beat contains a series of DOS commands, and is typically written to automate frequently-run tasks. Instead of typing the same commands again and again, you can simply double-click the batch file. Writing a batch file is much easier than you imagine. windows tools bat bat

The hard part is to make sure everything is done in the right order. A well-written script can save you a lot of time in the long run, especially it is often used in repetitive tasks.

How;

Open Notepad or notepad. The notebook allows you to write the code as a text file, and then save it as a batch file.
You can open the Notepad by clicking Start / Programs / Utilities / Notepad, or by right-clicking on the New / Text desktop.

Basic commands

Batch files perform a series of DOS commands, and the commands you can use are similar to DOS commands. Some of the most important are:

ECHO - displays the text on the screen
ECHO OFF - Hides the text
START - Execute a file
REM – To write one explanations in your program
MKDIR / RMDIR - Create and remove folders
OF - Deletes a file or files
COPY - Copy a file or files
XCOPY - Allows you to copy files with additional options
FOR / IN / DO - This command allows you to specify files.
TITLE - Edit the title

One of the easiest ways to learn to write bundle files is to focus on basics first. For example, you can use a batch file to quickly create a folder:

MKDIR C: \ example

Save the file. Once you've written the above code, you can save the file as txt. Then, turn off the .txt suffix and name the text file with the .bat or .cmd extension. If you are running the file you created, it will make a folder in C: \ with the example name.
Make sure that the is ANSI before saving the file

This way you can write a basic backup program . Batch files can perform many commands but today we will cover the basics.

With the XCOPY command, you can create a batch file that copies files from selected folders to a backup folder, replacing only the files that have been updated since the last backup:

Let's say you want to copy the test folder from C: \ into the iguru.gr folder. The command you will write in notepad will be like this:

ECHO OFF XCOPY c: \ test c: \ iguru.gr / m / e / y

The command as mentioned above copies the files from the "test" folder to the "iguru.gr" folder. You can replace the folder names we use with the paths to the folders you want. / M specifies that only updated files will be copied, / e specifies that all folders in the test folder will be copied and PC will give you a confirmation message each time a file is replaced.

Save the file. Once you've written the above code, you can save the file as txt. Then, turn off the .txt suffix and name the text file with the .bat or .cmd extension. You can try to run it.

We give you some ready-made files that may be useful to you.

Open it Word

@echo off start / d "C: \ Program Files \ Microsoft Word" WINWORD.EXE

(Change the path to the folder where yours is installed )

Make a list of the programs you have within Program Files

@echo off dir "C: \ Program Files"> C: \ list_of_program_files.txt

iGuRu.gr The Best Technology Site in Greecefgns

every publication, directly to your inbox

Join the 2.082 registrants.

Written by giorgos

George still wonders what he's doing here ...

Leave a reply

Your email address is not published. Required fields are mentioned with *

Your message will not be published if:
1. Contains insulting, defamatory, racist, offensive or inappropriate comments.
2. Causes harm to minors.
3. It interferes with the privacy and individual and social rights of other users.
4. Advertises products or services or websites.
5. Contains personal information (address, phone, etc.).