I really like using the command line. Occasionally, I'll be in a directory
and I'll want to launch the program which is associated with a file
(like launch MS-Word to open foo.doc). In Windows Explorer, you just double click
and it happens.
This is my solution for opening files from the command line.
It uses the ShellExecute function and works with
directories as well as files. I like using
cygwin so the cygwin version
translates the path passed in (it's aware of symbolic
links, the mount table, etc.). This way any cygwin style path will yield
the expected behaviour. The Win32 version does no translation.
The cygwin version of open.exe was built using an older cygwin1.dll (prior
to 1.5) but it works fine with the 1.5 version as well.
This program has only been tested under Windows 2000 and Windows XP.
|
open.exe | | Cygwin version of the executable |
open.exe | | Win32 version of the executable |
open.cpp | | The source code |
getopt.c | | Standard command line parsing |
getopt.h | | Standard command line parsing |
makefile | | makefile for building cygwin version |
makefile.vc | | makefile for building Win32 version (works with make or nmake) |
|
open.tar.gz | | Tar file containing all of the above files |
open.zip | | Zip file containing all of the above files |
|
Usage: open [-vh] [-d dir] [-p params] file ...
Options:
-h Print this screen
-v Verbose mode
-d dir Sets the current directory to 'dir'
-p params Passes 'params' (only for executables)
|