0

Is it possible (using cmd or .bat) to automatically open a text file using the default Windows application?

For example, when opening a .html file, if Chrome is my default browser, the .html will open with Chrome automatically. How can I tell the cmd (or .bat) to open the default program for a particular file extension?

2 Answers2

2

Use the start command, which I believe uses ShellExecute():

start "" "My text file.txt"

(The first empty parameter is often required.)

u1686_grawity
  • 452,512
2

That is what the START command is for.
START <name of document> will load the document in the default application.

Tonny
  • 31,463