Question

I have the following CustomAction:

<CustomAction Id="CopyToSystem32" ExeCommand="copy /y 64bits.txt C:\Windows\System32" Directory="INSTALLFOLDER" Impersonate="no" Execute="deferred" Return="asyncWait" />

<InstallExecuteSequence>
  <Custom Action="CopyToSystem32" After="InstallFiles" >VersionNT64</Custom>
</InstallExecuteSequence>

So when it detects a 64 bits OS, it will copy a file to System32 folder. If I execute it with a .bat file, it works fine. But I would prefer it to be a batch command.

The log says the following:

MSI (s) (74:AC) [10:08:33:473]: Executing op: ActionStart(Name=CopyToSystem32,,)
Action 10:08:33: CopyToSystem32. 
MSI (s) (74:AC) [10:08:33:473]: Executing op:         CustomActionSchedule(Action=CopyToSystem32,ActionType=3234,Source=C:\Program Files    (x86)\SetupProject\,Target=copy /y 64bits.txt C:\Windows\System32,)
MSI (s) (74:AC) [10:08:33:474]: Executing op:     ActionStart(Name=RegisterProduct,Description=Registering product,Template=[1])
Action 10:08:33: RegisterProduct. Registering product
MSI (s) (74:AC) [10:08:33:474]: Executing op: ChangeMedia(,MediaPrompt=Please insert the disk:     ,MediaCabinet=1\cab1.cab,BytesPerTick=0,CopierType=1,,,SignatureRequired=0,,,IsFirstPhysicalMedia=1)
MSI (s) (74:AC) [10:08:33:474]: Executing op:     DatabaseCopy(DatabasePath=C:\Windows\Installer\32ea43.msi,ProductCode={0C013216-61FB-4283-AF0A-    6CB264019F5B},,,)
MSI (s) (74:AC) [10:08:33:474]: Note: 1: 1402 2:     UNKNOWN\Products\612310C0BF163824FAA0C62B4610F9B5\InstallProperties 3: 2 
1: CopyToSystem32 2: 1631    

Any idea on why my ExeCommand is not copying my file?

Thanks!

Was it helpful?

Solution

AFAIK copy is part of the command shell interpreter and not a command on its own. E..g You can check this if you e.g. do a dir copy.* /s in the Windows-folder. There is no file that independently implements copy. What you can do: prepend the invocation of the command interpreter, e.g.:

cmd /c copy /y 64bits.txt C:\Windows\System32

The /c-parameter tells the interpreter to close after the execution (you could also use the [%COMSPEC]-environment variable instead of cmd). You could also use the CAQuietExecute custom action to prevent the cmd popup, as described here.
Maybe you could also just use the CopyFile-element for your task? This way you don't have to deal with the shell window etc.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top