Hello.bat - First Batch File

Q

How to write a batch file? I want to print "Hello world!" message on the screen.

✍: FYIcenter.com

A

You can follow this tutorial to write your first batch file to print a message on the screen.

1. Open "Notepad" to create a file called, \fyicenter\Hello.bat, with the following commands:

@echo off
echo Hello world!

2. Open a command line window, and type in the following command to verify the batch file:

C:\>cd \fyicenter
C:\fyicenter>dir Hello*.*

 Directory of C:\fyicenter

11/22/2033  07:27 PM                28 Hello.bat

3. Make sure the batch file name extension is ".bat".

4. Run the batch file, Hello.bat, by typing the batch file name with or without the file name extension. You see the "Hello world!" message displayed on the screen:

C:\fyicenter>Hello.bat
Hello world!

C:\fyicenter>Hello
Hello world!

 

Batch File Structure and Syntax

Commands Supported in Batch Files

Introduction of Windows Batch File

⇑⇑ Windows Batch File Tutorials

2023-09-06, 56197🔥, 11💬