Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On Mac OS X and GNOME on Linux, there are commands that can be used to open files from the command line in their associated GUI editors: open and gnome-open, respectively. Is there any command like this for Windows?

share|improve this question
@badp: I mentioned "GNOME on Linux" not just Linux. – Wuffers Feb 17 '11 at 2:33
Whoops, sorry. – badp Feb 17 '11 at 2:34
@badp: No worries. ;) – Wuffers Feb 17 '11 at 2:35
up vote 25 down vote accepted

If you are currently in the command prompt and have a file called test.png and , which are located in c:\test you can do the following:

If you are at the directory (so should say c:\test>) just type:


which would open test in the default png picture editor.

If the files name contains spaces, then simply enclose the file name within " "

 "this image.png"

You can alternatively type:


which will open the file no matter where you currently are.

Finally, you can pass the picture to another program. For example, if you have an image editor called imageedit.exe and it supports opening files through command lines (and if the program is pathed/accessible or you are in it's current directory), you can type the following:

 imageedit c:\test\test.png
share|improve this answer

If it is a registered extension, you can use "start" as in

start WordDoc.doc
share|improve this answer

This may come a bit late, but the correct command for editing a file name in Windows 7 is "write file_name"

This should open up the default text editor and you should be able to edit the file easily

Edit: It seems to open only Wordpad. For me that was the default text editor.

share|improve this answer
Nice trick. It does not start the default text editor however. My default editor for .txt files is Crimson editor, but this command opens Wordpad. – Jan Doggen Jul 31 '14 at 18:30
Yes, it does so for me too. Wordpad was default for me. Thanks for the update! Regardless, hope this helps the original poster. – Aakar Aug 1 '14 at 23:01

If you run the following command

powershell -c "filepath"

It uses powershell and passes the string in as a command. Just using the file path will open the item. No sense in passing in anything fancy per this.


Simple and versatile.

share|improve this answer
Except that it doesn't work. powershell -c "test.txt" "test.txt : The term 'test.txt' is not recognized as the name of a cmdlet, function, script file, or operable program". From a cmd shell` the command test.txt does work. – DavidPostill Feb 5 at 11:28
Did you even read the source? "test.txt" is not a file path. I tested this myself it works. powershell -c "c:\users\name\documents\test.txt" That will work. There is no way for dos or powershell to just know what file you are talking about on your whole system. If you are not scoped to that directory when you run 'test.txt', then of course it wont work because it doesn't exist in that directory. – Eric 35 mins ago

In the Windows command prompt, you can run

edit [file_name]

in order to view batch files/logs/text files etc. This command requires QBASIC.EXE, which is by default present in Windows.

See here for other useful MS-DOS commands.

share|improve this answer
Doesn't seem to work on Windows 7 64-bit, neither edit nor qbasic.exe are recognised. Also, this only works with plain text files. – Indrek Sep 10 '12 at 7:06
@Indrek, Not recognized on Win8 too. – Pacerier Mar 20 '15 at 7:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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