I'm currently trying to learn Batch file scripting so maybe I'm just not seeing what I'm doing wrong but I am just making a very simple batch file that opens up a text file.

Here is the code I am using:

@echo off
title Opening a File Lesson
START "C:\Projects\batch\hi.txt"

Instead of opening the textfile like it should, all it does is open the Batch File command prompt with the corresponding output:

Press any key to continue . . .

Which is fine, that's what I intended but then instead of opening the text file, it just opens ANOTHER command prompt with the file path: C:\Projects\batch\hi.txt as the caption and does absolutely nothing but output my default path:

Microsoft Windows [Version 6.1.7600] Copyright (c) 2009 Microsoft Corporation. All rights reserved.


Can someone guide me as to what I am doing wrong and why it's not opening with a default program? I tried opening other files too like Outlook and Visual Studio 2010 using the absolute(target) path and it does the same thing so its not just text files. Any help would be appreciated, I'm not used to scripting languages just yet.

marked as duplicate by Karan, Scott, Brad Patton, Simon, Gaff Apr 25 '13 at 16:17

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    tried with no start and no " " ? – Lorenzo Von Matterhorn Apr 24 '13 at 15:13
  • 2
    "start" opens a new CMD. If you want it to launch a program, put the name of the program instead. – sep332 Apr 24 '13 at 15:14
  • 2
    If you are just starting to learn and you are on W7 or you don't mind installing it, I would highly recommend learning Powershell instead. – EBGreen Apr 24 '13 at 15:20
  • @EBGreen Well I plan to branch into other languages and environments as well but the company I work for uses batch scripts a lot so I have to learn the syntax. Using the direct file path without the start and " " seems to work, but I can't help but get the feeling that's a sloppy way of doing it. Is that the correct way? – Chris Apr 24 '13 at 15:23
  • Sure, as long as you're comfortable with the system deciding what program to use to open the file, it's no problem. – sep332 Apr 24 '13 at 15:30

To keep in line with your current example, I would add the following:

START "" notepad.exe C:\Projects\batch\hi.txt

because what you really want to do is open notepad and pass in a parameter, in this case it's the filename. Athom's solution may work also, but this one just sprung to mind.

If you want to wait for notepad to close before you finish:

START "" /wait notepad.exe C:\Projects\batch\hi.txt

The title of the new batch window is inside the quotes, in my examples I don't need a title so I leave it blank. I think the START command expects one, so it might be mandatory.

I also suggest learning powershell when your done, the words power and shell really describe it's usefulness. I wouldn't say give up on batch though because right now some things are just easier in batch. Also at this point powershell can't return negative exit codes which just sucks, but I digress.


.txt does not require the start command.

Just call it:


Other formats DO require the start, for example csv I use start.

  • 3
    BTW, the ability to just call these applications without the start command (or even with it [but without specifically calling notepad.exe] as BigHomie is doing) is provided via the Windows MIME file type handling mechanism. Meaning that any file type which you can double click to open should work the same way here. The default action will be used. IOW, If Athom wanted CSV files to work he could associate CSV with notepad and he'd be able to use those files in the same way. – krowe2 Oct 28 '14 at 16:06

Not the answer you're looking for? Browse other questions tagged or ask your own question.