- Our video
- What is a batch file?
- Create a blank batch file
- Some useful examples of Ms-dos commands
- Create your batch file
- Little warning !!
- Other links
Our video
Loading your video "FAQ: Create batch files"What is a batch file?
A batch file first and foremost has the extension . Beat ou .cmd.
It is in fact a line (or set of lines) of ms-dos command "coded" in the form of a text file whose extension has been changed.
Then opening this file will execute the commands written in this file.
Create a blank batch file
Indeed this will be the basis of all the commands that we will develop further!
- Right click on the Desktop -> New -> Text document ;
- Open this file and rename it to . Beat ou .cmd ;
- Example:
- Then to open this file and modify it, right click on it:
Some useful examples of Ms-dos commands
This command provides access to a detailed list.
help
You can also specify the command, for example:
defrag help
(defrag /? also works)
Otherwise here are some commands:
- chkdsk ----> Allows you to check the file system for errors. Note: can be used with the option /f to correct errors (Requires restarting the machine after confirmation O).
- Ping www.nomd'unsiteweb.com ----> Allows you to ping IP addresses or domain names.
- Tracert www.nomd'unsiteweb.com ----> Allows you to determine the route traveled from you to IP addresses or domain names.
- Vol C: ---> Used to give the name of the volume (hard disk) and its serial number (Replace C: by that of the reader of your choice).
- Title EtLeTitreQuiVousplaît ----> Allows you to change the title of the current MS-DOS window.
- Echo LeTexteQueVousVoulez ----> Show text on screen
- Shutdown with the parameters:
- r ----> Allows you to restart the system.
- s ----> Allows you to power off the system.
- p ----> Allows you to turn off the computer without the usual delay. (For Vista and Seven).
- h ----> Put the local computer in hibernation.
- rundll32.exe user32.dll, LockWorkStation ----> Lock the local computer.
- tasklist ----> Allows you to see all the launched processes and their PIDs.
- Time ----> Allows you to view and modify the system time.
- systeminfo ----> Gives physical and software information on the configuration of the machine.
- Print textfileaddress ----> Print a text file or a photo. Enter the address of the file as: print C:windowsphoto.jpg
- exit ----> Exits the current MS-Dos window. (Always place at the end of your batch files in general).
- class ----> It erases the current screen. Very useful when you code a program with options in particular.
So much for the main MS-Dos commands, of course there are still hundreds of them.
Create your batch file
You just have to open your blank batch file and "compose" commands like a salad actually composed:
Uh no sorry little mistake ...
Little warning !!
It is obvious that these commands are simple and not very risky, but it is essential to be very careful with the Ms-Dos commands which, however diverse they may be, can be dangerous when misused!
Other links
All about DOS commands
What is a batch file?