Coming from Mac OS X, you can type:
open yourfilehere.txt
and your file will open just as if you had opened it from Finder.
On Windows, I'd like to be able to open files in the same manner. What's the command?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Sign up to join this communityJust drop the 'open' and you're set.
Enter the filename and it will open with the appropriate program.
You'll need to consider the path to the file, so executing the above would only work if the file is within the current directory.
cmd.exe
and won't work if you use a different shell like bash
or zsh
. I ended up using start
, as suggested in other answers.
In addition to the easy way that Luke pointed out, there's also the start
command:
> start yourfilehere.txt
but watch out, if your filename has spaces in it, you'll need to do this:
> start "" "your file here.txt"
While just typing the name is shorter, the start command jweede points out is better if you want to open a directory in Explorer instead (like open directoryName opens a folder in finder on OSX).
I use "start .
" all the time.
However, you don't need the extra syntax he showed. Just start fileName
works fine. The first "" is for the title, which is optional anyway.
% rundll32 url.dll,FileProtocolHandler xyz.bar
why not use "start /c" as mentioned above? because if the xyz.bar is missing the executable flag, you will get something like "access denied". this is also true for one of the answers to 'just drop the "open" term and the shell will handle the rest'
and as i learned right now, 'cygstart' does an excellent job on cygwin as well (see Linux equivalent command for "open" command on Mac/Windows?)
open
. So I can simply open x
just like I'm used to on the mac.
A few more options to consider.