When the destination file doesn't exist, xcopy will prompt and wait with:
Does C:\Program Files\ShawnCo\TestApp.exe.config.bak specify a file name or
directory name on the target (F = file, D = directory)?

"echo f | xcopy" pipes the 'f' character to xcopy, essentially auto
completing the prompt so the user doesn't have to enter anything.


On Tue, Sep 23, 2008 at 1:43 PM, Neil Sleightholm <[EMAIL PROTECTED]>wrote:

> What does the "echo f | xcopy" do? Can't you just use the xcopy?
>
> -----Original Message-----
> From: Shawn Dwyer [mailto:[EMAIL PROTECTED]
> Sent: 23 September 2008 18:27
> To: General discussion for Windows Installer XML toolset.
> Subject: Re: [WiX-users] Using cmd in a CustomAction
>
> Thanks Neil, good point.  On the command line,
>
> if I execute:
>     for /r "C:\Program Files\Xerox\XPIM 2.0\" %f in (*.config) do (
> echo f
> | xcopy /q /y "%f" "%f.bak" )
> echo %ERRORLEVEL% gives me 0.
>
> if I execute:
>     cmd /q /e:on /k "for /r "C:\Program Files\Xerox\XPIM 2.0\" %f in
> (*.config) do ( echo f | xcopy /q /y "%f" "%f.bak" )"
> echo %ERRORLEVEL% gives me 0.  Also after I exit that instance of cmd
> echo
> %ERRORLEVEL% is still 0.
>
> if I execute:
>     cmd /q /e:on /c "for /r "C:\Program Files\Xerox\XPIM 2.0\" %f in
> (*.config) do ( echo f | xcopy /q /y "%f" "%f.bak" )"
> echo %ERRORLEVEL% gives me 6553692.  I couldn't seem to find this error
> online anywhere.
>
> I suppose I could set it to ignore the return code, but then I won't
> catch
> any real errors.
>
> Any ideas?  Is there a better way to do this?  I could write a c++
> custom
> action for this, but I'd like to understand whats going if possible.
>
> Thanks,
>
> Shawn
>
>
> On Tue, Sep 23, 2008 at 1:03 PM, Neil Sleightholm
> <[EMAIL PROTECTED]>wrote:
>
> > I posted this last week but it didn't seem to get on this list:
> >
> > When you say that the command works ok from the command line have you
> > checked the value of "%errorlevel%" after running it, this is the
> value
> > that windows installer would check to indicate and error. It rings a
> > bell that "for" returns a non zero value.
> >
> > Neil
> >
> > Neil Sleightholm
> > X2 Systems Limited
> > [EMAIL PROTECTED]
> >
> > -----Original Message-----
> > From: Shawn Dwyer [mailto:[EMAIL PROTECTED]
> > Sent: 23 September 2008 17:54
> > To: General discussion for Windows Installer XML toolset.
> > Subject: Re: [WiX-users] Using cmd in a CustomAction
> >
> > Anyone have any ideas why I'm getting an error?  Is there a better way
> > to
> > achieve this?
> > Thanks,
> >
> > Shawn
> >
> > On Fri, Sep 19, 2008 at 1:46 AM, Shawn Dwyer
> > <[EMAIL PROTECTED]>wrote:
> >
> > > Hi,
> > > We are preparing to release the next version of our product, which
> > will
> > > completely remove all previous versions. However, before
> uninstalling
> > we
> > > want to back up all the configuration files for the user.  To
> > accomplish
> > > this I thought I'd just use cmd.exe and a simple 'for' command  to
> > make a
> > > copy of all the files.  Here is the magic:
> > >
> > > <CustomAction Id="SetPathToCmd" Property="Cmd"
> > > Value="[SystemFolder]cmd.exe" />
> > > <CustomAction Id="BackUpConfigFiles" Property="Cmd" ExeCommand="/q
> > /e:on /c
> > > &quot;for /r &quot;[INSTALLDIR]&quot; %f in (*.config) do ( echo f |
> > xcopy
> > > /q /y &quot;%f&quot; &quot;%f.bak&quot; )&quot;" />
> > >
> > > <InstallExecuteSequence>
> > > <Custom Action="SetPathToCmd" Sequence="100">NOT Cmd</Custom>
> > >  <Custom Action="BackUpConfigFiles" After="SetPathToCmd" />
> > > </InstallExecuteSequence>
> > >
> > > The custom action runs and successfully copies all the files,
> however
> > the
> > > install fails with minimal information shown below.  I thought I'd
> > change
> > > the /c (exit cmd when done) with /k (leave cmd open) to see what
> > errors it
> > > might have, but with /k there are no errors in the command window,
> and
> > when
> > > I close it the installer finishes successfully.  Also if I copy and
> > paste
> > > this into a command window everything runs fine as expected.  Any
> > ideas on
> > > what might be going wrong or how I can do this?
> > >
> > > Thanks,
> > >
> > > Shawn
> > >
> > > MSI (s) (9C:D0) [01:34:16:479]: Doing action: BackUpConfigFiles
> > > MSI (s) (9C:D0) [01:34:16:479]: Note: 1: 2205 2:  3: ActionText
> > > Action start 1:34:16: BackUpConfigFiles.
> > > MSI (s) (9C:D0) [01:34:17:229]: Note: 1: 1722 2: BackUpConfigFiles
> 3:
> > > C:\WINDOWS\system32\cmd.exe 4: /q /e:on /c "for /r "C:\Program
> > > Files\ShawnCo\BackUpConfigTest\" %f in (*.config) do ( echo f |
> xcopy
> > /q /y
> > > "%f" "%f.bak" )"
> > > MSI (s) (9C:D0) [01:34:17:229]: Note: 1: 2205 2:  3: Error
> > > MSI (s) (9C:D0) [01:34:17:229]: Note: 1: 2228 2:  3: Error 4: SELECT
> > > `Message` FROM `Error` WHERE `Error` = 1722
> > > MSI (c) (90:F0) [01:34:17:244]: Font created.  Charset: Req=0,
> Ret=0,
> > Font:
> > > Req=MS Shell Dlg, Ret=MS Shell Dlg
> > > Error 1722. There is a problem with this Windows Installer package.
> A
> > > program run as part of the setup did not finish as expected. Contact
> > your
> > > support personnel or package vendor.  Action BackUpConfigFiles,
> > location:
> > > C:\WINDOWS\system32\cmd.exe, command: /q /e:on /c "for /r
> "C:\Program
> > > Files\Xerox\XPIM 2.0\" %f in (*.config) do ( echo f | xcopy /q /y
> "%f"
> > > "%f.bak" )"
> > > MSI (s) (9C:D0) [01:34:18:745]: Note: 1: 2205 2:  3: Error
> > > MSI (s) (9C:D0) [01:34:18:745]: Note: 1: 2228 2:  3: Error 4: SELECT
> > > `Message` FROM `Error` WHERE `Error` = 1709
> > > MSI (s) (9C:D0) [01:34:18:745]: Product: BackUpConfigTest -- Error
> > 1722.
> > > There is a problem with this Windows Installer package. A program
> run
> > as
> > > part of the setup did not finish as expected. Contact your support
> > personnel
> > > or package vendor.  Action BackUpConfigFiles, location:
> > > C:\WINDOWS\system32\cmd.exe, command: /q /e:on /c "for /r
> "C:\Program
> > > Files\Xerox\XPIM 2.0\" %f in (*.config) do ( echo f | xcopy /q /y
> "%f"
> > > "%f.bak" )"
> > >
> > > Action ended 1:34:18: BackUpConfigFiles. Return value 3.
> > > Action ended 1:34:18: INSTALL. Return value 3.
> > >
> > >
> >
> ------------------------------------------------------------------------
> > -
> > This SF.Net email is sponsored by the Moblin Your Move Developer's
> > challenge
> > Build the coolest Linux based applications with Moblin SDK & win great
> > prizes
> > Grand prize is a trip for two to an Open Source event anywhere in the
> > world
> > http://moblin-contest.org/redirect.php?banner_id=100&url=/
> > _______________________________________________
> > WiX-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/wix-users
> >
> >
> ------------------------------------------------------------------------
> -
> > This SF.Net email is sponsored by the Moblin Your Move Developer's
> > challenge
> > Build the coolest Linux based applications with Moblin SDK & win great
> > prizes
> > Grand prize is a trip for two to an Open Source event anywhere in the
> world
> > http://moblin-contest.org/redirect.php?banner_id=100&url=/
> > _______________________________________________
> > WiX-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/wix-users
> >
> ------------------------------------------------------------------------
> -
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the
> world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> WiX-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> WiX-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to