Mail Archives: cygwin/2002/03/02/17:12:41
Hi,
I've written a little "start" utility, which is similar to "cmd /c start",
only better.
It allows you to let Windows start a program or open a file or URL.
For instance:
- it understands POSIX paths (e.g. "start /tmp/hello.txt")
- it can open files which don't have the "executable" flag set (ntsec)
- it can start things minimized, hidden, etc. (e.g. start --minimize
hello.txt")
- it can run non-default actions (e.g. "start --print hello.txt",
"start --explore .", "start --action=whatever myfile.ext")
- it's a lot faster than "cmd /c start"
I believe it should run on all Windows versions from Win95 up, but I've
only tested it on Windows 2000. (Anyone using Win9x/ME, can you please let
me know if it works?)
(It's been a while since I did any serious C programming, so the code might
be sloppy in some places. Improvements and bug reports are welcome.)
You can download it at: http://www.mscha.com/start_0_9.zip .
(Chuck, if you think this would be a good addition for cygutils, feel free
to include it! After all, I did "borrow" some of the code framework from
it. :-) )
I'll include the output of "start --help" below.
Best regards,
- Michael
--------------------------------8<-------------------------------
start version 0.9, by Michael Schaap
Let Windows start a program or open a file or URL.
Usage: start [OPTION]... FILE [ARGUMENTS]
Action options
-a, --action=STRING Use specified action instead of default
-o, --open Short for: --action open
-x, --explore Short for: --action explore
-e, --edit Short for: --action edit
-f, --find Short for: --action find
-p, --print Short for: --action print
Directory options
-d, --directory=STRING Set working directory
Show options
--hide Hides the window and activates another window
--maximize Maximizes the specified window
--minimize Minimizes the specified window and activates the
next top-level window in the z-order
--restore Activates and displays the window. If the window
is minimized or maximized, Windows restores it to
its original size and position. An application
should specify this flag when restoring a
minimized window
--show Activates the window and displays it in its
current size and position
--showmaximized Activates the window and displays it as a
maximized window
--showminimized Activates the window and displays it as a
minimized window
--showminnoactive Displays the window as a minimized window. The
active window remains active
--showna Displays the window in its current state. The
active window remains active
--shownoactivate Displays a window in its most recent size and
position. The active window remains active
--shownormal Activates and displays a window. If the window is
minimized or maximized, Windows restores it to
its original size and position. An application
should specify this flag when displaying the
window for the first time
Help options
-?, --help Show this help message
--usage Display brief usage message
--version Display version information
--license Display licensing information
--reference Open MSDN reference for ShellExecute
With thanks to MSDN:
<http://msdn.microsoft.com/library/en-us/shellcc/platform/Shell/reference/functions/shellexecute.asp>
Please report any bugs to <cygwin_start AT mscha DOT org>.
--
I always wondered about the meaning of life. So I looked it
up in the dictionary under "L" and there it was - the meaning
of life. It was not what I expected. - Dogbert
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -