Silent Start v0.1 – Launch windows console apps silently

by bobbigmac

I recently ran into a bug on Firefox which caused console-based executables launched from within a firefox extension to show the ugly console window when running on windows.

I need to execute the fantastic exiv2 application to read/write metadata and really didn’t want to be displaying ugly boxes to lots of people. The options were pretty much to either kludge it with vbscript (yuk), or do something a little less kludgy, hence Silent Start.

It still needs work, but for now it suits my purposes. The source is included in the archive so if anybody wants to improve it, please do so. It is licensed CC-BY-SA. It would be great to receive any fixes or amendments.

Name: SilentStart
Version: 0.1
Author: Robert.A.Davies (bobbigmac) admin@robertadavies.co.uk
Description: SilentStart is a very simple wrapper for the windows CreateProcess api call.

Usage:
silentstart.exe "c:\path\name.exe" [params...]

Instructions:
First command-line parameter should be the name or full path of the application you wish to execute.
All remaining parameters will be passed to that executable.
The SilentStart process waits for the silently called process to complete before terminating.
The exit code will be 1 if application fails to locate the executable and make the createprocess call.
The exit code will be returned from the called application if the call is made successfully.

Known issues:
1) Validation of command-line could be improved to check path format and existence of requested executable.
2) Attempts to write errors to stdout are non-functional (uses MessageBox as fallback).

Notes:
My C++ skills are limited at best, please ensure you check the source for problems or potential overflows before using in any production environment.

Licence: CC-BY-SA
Creative Commons Attribution Sharealike
http://creativecommons.org/licenses/by-sa/2.0/
No guarantees. Use entirely at your own risk.
It would be nice if you let me know when/where you are using it and of any issues you encounter.
Be Sociable, Share!