13 Votes

Batch Script: Open File with Notepad

Question by Guest | Last update on 2021-05-12 | Created on 2017-06-26

I would like to write a small batch script for Windows that automatically opens a text file (or multiple text files at once) via the text editor of Windows (Notepad).

Is there any command available for this, but I can use? Thank you very much!

2Best Answer2 Votes

You can use the following line for opening a file with the Windows Editor / Microsoft Notepad in your batch script:

notepad C:\path\to\file.txt

With this, the passed file will be opened and the script will wait until you have closed the editor.

If the script should not wait, you can write "start" at the start of the line. Then, the file will be opened and the script will continue without waking:

start notepad C:\path\to\file.txt

Using this command, you can also open multiple files at the same time:

start notepad C:\path\to\file1.txt
start notepad C:\path\to\file2.txt
start notepad C:\path\to\file3.txt

This will open the files file1.txt, file2.txt and file3.txt simultaneously in 3 different windows of Notepad. After that, the script will be closed without waiting for one of the windows. If you omit the "start", the script would open all files after each other.
2017-06-27 at 11:35

ReplyPositive Negative

Related Topics

PHP: File Download Script

Tutorial | 0 Comments

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.


Ask your own question or write your own article on askingbox.com. That’s how it’s done.