How To Make A Batch File Using Dos Commands

How To Make A Batch File: BATCH FILE is nothing but a text file that contains a series of batch or dos commands which can be executed sequentially and in the Desired order.

A batch file is created to reduce time by executing the same commands Which are used to run frequently? To create one of these files you don’t need special programming skills just some basic understanding of MS-DOS and dos commands.

A Batch file has an extension. BAT and any primary name or first name of your choice. To run a batch file you just need to type the primary name of a file in dos prompt

for Example :: I have created a batch file name abc.bat to run this I will type abc in dos prompt and will Press Enter.

Autoexec.bat is a prime example of a batch file that was used in earlier windows and msdos it would have necessary boot files which used to load every time the computer booted.

How to Write a Batch File?

Step No 1 ::

Go to Start —-> Run— >Cmd

Step No 2 ::

Type the following Dos Commands to create a Batch file

  • c:\>copy con abc.bat (Press Enter)
  • dir
  • dir/p/w
  • copy con
  • del pa.exe
  • PRESS CTRL+Z OR F6 To save the file

Now To run this .bat file just type abc in the command windows without the extension.

The command which I have included in .bat file will be executed sequentially which means the dir command will be executed first then dir/p/w then copy con so all this command will be executed in order.

Create .Bat file using Notepad

Step No 1 ::

Go to start—> Run —>Type Notepad

How To Make A Batch
How To Make A Batch

Step No 2 ::

Type the following command.

Dir
dir/p/w
copy con
del pa.exe

Just save the file with a .bat extension shown in image below.

How To Make A Batch
How To Make A Batch

Also Read ::

Command Used In Batch file

  • ECHO:: This command is used to print text on the display unit. Anything written after echo is displayed on the screen.
  • ECHO OFF:: Echo off is written before starting a bat file this tells the program don’t show the command while executing the code.
  • CLS:: This command clears the screen of previous outputs.
  • CALL:: This command is used to run another batch script within a batch file.If the batch file which is called does not exist it will display an error message.
  • EXIT:: This command is used to exit from dos windows.
  • IF:: if is used to check certain conditions. if the condition exists or comes out to true it will perform the given instruction.
  • REM:: It allows us to add comments or remarks between the codes and this remark is not displayed while the batch file is executed.
  • GOTO:: It is used to go to LABEL.
  • PAUSE:: Prompts the user to “Press any key to continue”.
  • IPCONFIG:: – output lot of network information in the dos screen.
  • PING:: – Pings an IP, let us know whether you are able to contact the requested IP.

Also Read ::

How to create a batch file acting like a virus?

Here we are going to see how to create a batch file which will open itself numerous amount of time which will presume to be a virus but let me tell you its harmless and this is a just an example on how to write a .bat file
Let start doing it

  • Step No 1::
  • Go to –> start — > Run
  • Step No 2 :: type cmd
  • Step No 3 :: now as you can see your command prompt has been opened just type the following code and run the file which will be named as virus.bat.
  • C:\>copy con virus.bat
  • Echo on (Press Enter)
  • Start virus.bat (Press Enter)
  • Echo off (Press Enter)
  • CTRL+Z OR F6 to save the file

Now note we have just created a bat file name virus.bat in c drive.go to c drive and double click on virus.bat we just created.

Batch Script which will delete all files in folder?

  • STEP 1 :: Click Start
  • STEP 2 :: Click Run
  • STEP 3 :: TYPE ….cmd

Consider u have a folder name songs in D drive you have to delete all files present in that folder… *Caution::: The Content of the website is only for Education purpose …Viewers are requested to execute the command’s on their personal responsibility …chtips.com will not be liable for any damage….:
Type the following command

  • c:\> copy con virus.bat (Press Enter)
  • d:
  • cd songs (Press Enter)
  • del/q *.* (Press Enter)
  • ctrl +z (Press Enter)

Now go to c drive a double click on the file name virus.bat..you will be amazed to see all the files in songs folder has been deleted.

17 thoughts on “How To Make A Batch File Using Dos Commands”

  1. MegaCool Blog indeed!… if anyone else has anything it would be much appreciated. Just wanted to say thanks and keep doing what you’re doing! Great website Enjoy!

    Reply
  2. Your artical is very simple however , retains a little elegance together with grace. And with all the options along with customization you could have enabled, I’m sure it would appeal to a lot bloggers. It’s really commendable that you are interested in let people, the end users, to employ a wide selection of themes for the blogs. Have you considered promoting your blog? add it to SEO Directoryright now

    Reply
  3. Hello!I am following your blog for some days now. I have to say that it is very easy to check out . It is added in my favourite list and i will try to track it recurrently. Thanks for the nice posts . On top of that, i actually like your web template and the way you have structured your page . Is it possible to tell me the name of your template ? Thanks

    Reply
  4. I have been searching for this information for quite some times. About three hours of online searching, at last I found it in your blog. I wonder why Yahoo dont display this kind of good websites in the first page. Usually the top search engine results are full of rubbish. Perhaps its time to use another search engine.

    Reply
  5. This sort of thing needs to happen! Really its a must to take a look past everything and get upset. Generally this will allow you to take the inititive to make things happen.

    Reply
  6. I’m wondering if you have noticed how the media has changed? What once seemed like a never-discussed issue has become more prevalent. Frankly, it is about time we see a change.

    Reply
  7. Its Pleasure to understand your blog.The around articles or blog posts is relatively extraordinary, and I quite enjoyed reading your blog and things that you expressed. I quite like to look back over a standard basis,post additional inside topic.Thanks for sharingkeep writing!!!

    Reply
  8. Very nice post. I have really enjoyed visiting your site posts. In any case, I’ll be subscribing to your feed and I hope you write again soon! Thanks a lot, I’ll attempt to visit more frequently. Happy new year!

    Reply
  9. Hey. I just bumped into your page while browsing Bing . Ive bookmarked it. Ill most certainly return. I was wondering, have you watched Inception yet? I know this is off topic. I want to stop by Blockbuster and buy it tonight. Its great. Bye.

    Reply
  10. I really enjoy this template you’ve got going on on your website. What is the name of the theme by the way? I was thinking of using this style for the website I am going to create for my class project.

    Reply
  11. My sister bookmarked this internet site for me and I have been reading through it for the past couple hours. This is really going to benefit me and my friends for our class project. By the way, I like the way you write.

    Reply
  12. Excellent article. Keep posting such kind of info on your site.
    I’m really impressed by your blog.
    Hey there, You have done an incredible job. I will definitely Dig it and for my part recommend it to my friends. I’m confident they’ll be benefited from
    this site.

    Reply
  13. I believed it was going to be some boring outdated post, but it seriously compensated for my time. I’ll post a hyperlink to this page on my weblog. I’m positive my site visitors will come across that as incredibly helpful.

    Reply
  14. Heya, I am for the first time here. I found this board and I find It truly useful & it helped me out a lot. I hope to give something back and help others as you helped me.

    Reply

Leave a Comment