ShelExec v1.14

Welcome to ShelExec, A very simple utility to allow you to call the ShellExecute API from the command line.

Contents
History
Copyright
Installation Requirements
Usage
Contacting the Author

History

V1.01 (16 July 1999)

- First public release.

V1.02 (9 April 2000)

- Fixed a bug where the verb "Open" was always used.
- Program now understands a /Verb:Value command line which allows the verb to be specified as used in the ShellExecute call. Not specifying a verb will use the default value for the file as setup in the registry.
- Program now understands a /ShowCmd:Value command line which allows the "nShowCmd" value to be specified as used in the ShellExecute call. Not specifying a value will use the value SW_SHOW.
- Code now uses MFC internally.
- Code now supports UNICODE and build configurations are provided

V1.1 (10 February 2001)

- Program now understands a /EXE command line which allows the a specific command line to be specified: e.g ShelExec.exe /EXE mplayer2.exe "/PARAMS:/play E:\WINNT\Media\canyon.mid".
- Program now understands a /DIR:Value command line which allows the startup directory for an application to be specified.
- Updated copyright information.

V1.11 (1 October 2001)

- Fixed a bug which was causing ShelExec to fail on some versions of Windows with the error code 1155.
- Updated version infos of the exectuable.
- Code now uses ShellExecuteEx instead of ShellExecute internally.
- A hidden window is now created when ShelExec starts. This allows verbs such as "properties" to now work correctly. Thanks to Santosh Rao for suggesting this addition.
- Icon used for ShellExec is now consistent with the new icon styles used by Windows XP.

29 July 2002

- Updated documentation which comes with ShelExec to explain how to work with filenames which contain embedded spaces.

V1.12 (17 October 2002)

- ShelExec is now compiled with Visual C++ 6 instead of Visual C++ 5.
- Removed an unreferrenced variable in CShelExecApp::InitInstance.
- Program now supports two parameters in the "/DIR", "/PARAMS" and filename command line values. These are: %EXEDRV% which gets replaced with the drive letter path where AutoPlay is run from. the other variable is %EXEDIR%. For example:
  ShelExec.exe "/PARAMS:/play %EXEDRV%\data\myfile.xyz" /EXE %EXEDIR%\Prog\MyProg.exe
  What this command line would achieve is to run a program called MyProg.exe located in the "D:\Prog" directory on the root of your CD (assuming your CD drive is D:) using the command line "/play D:\data\myfile.xyz".
  Thanks to Ted Tsoutsas for this nice update.

V1.13 (18 October 2002)

- Changed the format of replacable parameters from using a "%" to now use a "@". This is to avoid problems with replaceable environment parameters in the OS. Thanks to Ted Tsoutsas for reporting this problem. This means that the previous example in the v1.12 notes should now be used as:
  ShelExec.exe "/PARAMS:/play @EXEDRV@\data\myfile.xyz" /EXE @EXEDIR@\Prog\MyProg.exe
- Added a new replaceable parameter "@QUOTE" which puts a Quote character i.e. " into the string when the program is called. For example to call Notepad with the file "c:\A directory with spaces\file.txt" and ensure that the filename is embedded with quotes, you would use the following command line:
  ShelExec.exe "/PARAMS:@QUOTE@c:\directory with spaces\file.txt@QUOTE@" /EXE notepad.exe

V1.14 (24 January 2003)

- Now provides a /WAIT command line parameter. This allows the ShelExec application to only return when the application it starts has exited. Thanks to Igor Rabinovich for this suggestion.

Copyright

You are allowed to include the source code in any product (commercial, shareware, freeware or otherwise) when your product is released in binary form. You are allowed to modify the source code in any way you want except you cannot modify the copyright details at the top of each module. If you want to distribute source code with your application, then you are only allowed to distribute versions released by the author. This is to maintain a single distribution point for the source code.

Installation Requirements

- The program is for Win32 only and has no external requirements on dlls other than the ones shipped as standard with any Win32 platform.

Usage

- Places where you might find ShelExec useful are in adding an Autorun.inf file to your CD-R / CD-RW Discs. For example suppose you have a HTML page called index.htm on the root of your CD which you would like to run automatically whenever the user inserts the CD. All you need to do is put ShelExec.exe, some ico file and the index.htm files into the root directory and create a autorun.inf file with the following contents:

> [autorun]
> open=ShelExec.exe index.html
> icon=youricon.ico

- Items that ShelExec can handle include any file which is registered with the shell e.g. Word .Doc files, Text Files, batch files etc etc. It can also handle URLS such as "http://somesite.com", "ftp://www.microsoft.com" and "mailto:pjna@naughter.com".
- The more technically minded of you may say why is there a need to have this program since you can use "start filename" on autorun CD's without any apparent problems. The problem with this approach is that it does not work on NT because on NT "start" is implemented as an "Internal" command in cmd.exe (as opposed to a standard exe on 95/98) with the upshot that your CD's will not AutoRun on NT 4 or Windows 2000. Using ShelExec will mean that your CD's will autorun on all OS's which support it.
- Also remember that if the file you are calling contains spaces then you should include it in quotes. For example:

> [autorun]
> open=ShelExec.exe "a long filename.html"
> icon=youricon.ico

CONTACTING THE AUTHOR

PJ Naughter
Email: pjna@naughter.com
Web: http://www.naughter.com
24 January 2003