"steve" <(E-Mail Removed)> wrote in message
news:88B77594-03C7-4528-BA35-(E-Mail Removed)...
> Hi all,
>
> Here's some work in progress that should allow you to run a batch file as
> a
> custom action in a VS deployment project. Yup I know you can use js or
> wsh,
> but the target may not have either.. Essentially it's just a wrapper for
> the
> Process class and a command interpreter.
>
> Warning, it only partly works. I had wanted to pass in
>
> (a) The name of the batch file (through "BatchFileName"), and
> (b) A set of arguements for the batch file (through "BatchFileArgs")
>
> via the CustomActionData property exposed in the VS designer
>
> eg.
>
> /BatchFileName="[TARGETDIR]\InstallThirdParty.bat"
>
> Unfortunately, I can't find a way to pass embedded double-quote characters
> through BatchFileArgs. Passing embedded quotes is necessary when the
> arguements represent paths with embedded spaces.. I'd love to know if
> anyone
> has a workaround.
<skip>
> string BatchFileArgs = Context.Parameters["BatchFileArgs"];
>
> // The ComSpec arguement format string supports space delimeted
> double-quote framed args
> // BatchFileArgs represents a space delimited list of arguements.
> // Individual path / file name arguements that are passed via
> BatchFileArgs must be "" framed if they contain spaces
> // eg. BatchFileArgs could be the following '"C:\Test Dir\"
> C:\TestDir2 123'
> //
>
> mCmdInterpreter.StartInfo.Arguments = string.Format("/c \"\"{0}\"
> {1}\"", BatchFileName, BatchFileArgs);
why doing so? if parameter ( BatchFileArgs ) has value "C:\test 123" adding
more double-quotes?
You can detect if there are double quotes in the BatchFileArgs, an
appropriately preprocess it ( add or remove double quotes )
--
Regards, Vadym Stetsyak
www:
http://vadmyst.blogspot.com