Computers & Internet Logo

Related Topics:

Posted on Jan 04, 2011
Answered by a Fixya Expert

Trustworthy Expert Solutions

At Fixya.com, our trusted experts are meticulously vetted and possess extensive experience in their respective fields. Backed by a community of knowledgeable professionals, our platform ensures that the solutions provided are thoroughly researched and validated.

View Our Top Experts

How to create simple batch files - Computers & Internet

3 Answers

Anonymous

Level 2:

An expert who has achieved level 2 by getting 100 points

All-Star:

An expert that got 10 achievements.

MVP:

An expert that got 5 achievements.

Vice President:

An expert whose answer got voted for 100 times.

  • Expert 158 Answers
  • Posted on Jan 04, 2011
Anonymous
Expert
Level 2:

An expert who has achieved level 2 by getting 100 points

All-Star:

An expert that got 10 achievements.

MVP:

An expert that got 5 achievements.

Vice President:

An expert whose answer got voted for 100 times.

Joined: Jan 04, 2011
Answers
158
Questions
1
Helped
43258
Points
587

Creating a batch file
MS-DOS users
Microsoft Windows and other users

MS-DOS users
To create a basic batch file in MS-DOS, follow the below steps that give you an example of how to create a basic batch file.

  1. Open an MS-DOS command window or get to MS-DOS. Additional information about doing this can be found on document CHDOS.
  2. At the MS-DOS prompt, type: edit test.bat and press enter.
  3. If typed properly, you should now be in a blue screen. Within the screen, type:

    pause
    dir c:\windows
    dir c:\windows\system

  4. Once the above three lines have been typed in, click File and choose exit; when prompted to save, click "Yes." Users who do not have a mouse cursor can accomplish this same task by pressing ALT+F to access the file menu, then pressing "X" to exit, and pressing enter to save changes.
  5. Once you are back at the MS-DOS prompt, type: test and press enter. This will execute the test.bat file and begin running the file. Because the first line is pause, you will first be prompted to press a key. Once you press a key the batch file will run line-by-line; in this case, listing the files in the windows and windows\system directories.
If you wish to add more lines to this batch file you would simply type "edit test.bat" to edit the file again.
Additional information about the MS-DOS edit command can be found on our edit command page. Some versions of MS-DOS and bootable diskettes may not have the edit command; if this is the case, you would either need to obtain the edit.com file to access this file or use the copy con command.




Microsoft Windows and other users
A Windows user can still use the above MS-DOS steps if they wish to create a batch file. If, however, you're more comfortable using Microsoft Windows or your operating system, you can use any text editor, such as Notepad or Wordpad, to create your batch files, as long as the file extension ends with .bat. In the below example we use the Windows notepad to create a batch file.
  1. Click Start
  2. Click Run
  3. Type: notepad and press enter.
  4. Once notepad is open, type the below lines in the file or copy and paste the below lines into notepad.

    @echo off
    echo Hello this is a test batch file
    pause
    dir c:\windows

  5. Click File and click Save; browse to where you want to save the file. For the file name, type "test.bat", and if your version of Windows has a "Save as type" option, choose "All files", otherwise it will save as a text file. Once all of this has been done click the Save button and exit notepad.
  6. Now, to run the batch file, simply double-click or run the file like any other program. Once the batch file has completed running it will close the window automatically.

Anonymous

Level 1:

An expert who has achieved level 1.

New Friend:

An expert that has 1 follower.

Corporal:

An expert that has over 10 points.

  • Contributor 4 Answers
  • Posted on Oct 04, 2012
Anonymous
Contributor
Level 1:

An expert who has achieved level 1.

New Friend:

An expert that has 1 follower.

Corporal:

An expert that has over 10 points.

Joined: Oct 04, 2012
Answers
4
Questions
2
Helped
726
Points
18

I've been (no joke) a professional Batch File Programmer for about 5 years(before I joined the Navy). If anyone needs help, just ask. :)

Ad

TechRx Inc http://techrxgb.com

Level 1:

An expert who has achieved level 1.

MVP:

An expert that got 5 achievements.

Champion:

An expert who has answered 200 questions.

Governor:

An expert whose answer got voted for 20 times.

  • Contributor 331 Answers
  • Posted on Jan 04, 2011
TechRx Inc http://techrxgb.com
Contributor
Level 1:

An expert who has achieved level 1.

MVP:

An expert that got 5 achievements.

Champion:

An expert who has answered 200 questions.

Governor:

An expert whose answer got voted for 20 times.

Joined: Jul 17, 2010
Answers
331
Questions
0
Helped
78549
Points
25

Batch files need to end in the file name .bat. A super simple way to do it in dos would be to type at the C:\> type: copy con: filename.bat (this will create the file) then type the echo command "echo" is used to put text on the screen. Then, end with a control +z which will create a ^Z and it will say "one file copied" this will result in a simple batch file that says whatever is put after echo. To launch the file, type filename.bat ... So, to recap it should look similar to this:

copy con: filename.bat
echo Hi World
^Z (control + Z)

Add Your Answer

×

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

279 views

Ask a Question

Usually answered in minutes!

Top Computers & Internet Experts

ADMIN Andrew
ADMIN Andrew

Level 3 Expert

73783 Answers

ADMIN Eric
ADMIN Eric

Level 3 Expert

42221 Answers

Brad Brown

Level 3 Expert

19190 Answers

Are you a Computer and Internet Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...