Problem with echo to specific directory - Advanced Installer Community
nirs
Posts: 42
Joined: Wed Aug 13, 2014 2:46 pm

Problem with echo to specific directory

Hi,

I want to echo to a file under 'AppDataFolder'.

The file name is apache-installer-status.cmd
During the installation I create that file using the custom action 'LaunchExeWithDirectory'
The 'Working' is set to 'AppDataFolder'.
I tried the follwing on 'Command' field:
1) /C "echo @echo off >[AppDataFolder]apache-installer-status.cmd" - Didn't do anything.
2) /C "echo @echo off >[%AppDataFolder]MobileCloud\apache-installer-status.cmd" - Didn't do anything when 'MobileCloud' is not exists. When 'MobileCloud' was exists on target machine it worked.
3) /C "echo @echo off >[AppDataFolder]MobileCloud\apache-installer-status.cmd" - Didn't do anything.
4) /C "echo @echo off >[%AppDataFolder]apache-installer-status.cmd" - This is was the only command that worked. It created the file apache-installer-status.cmd under C:\Documents and Settings\Administrator\Application Data.
The issue is that I need that the file will be created under:
C:\Documents and Settings\Administrator\Application Data\MobileCloud\
I can't guarantee that the MobileCloud folder is exists on target machine.
Can you please advice?
Can you please explain why it is working using the system environment variable while using the property it doesn't work?
Thanks
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Problem with echo to specific directory

Hi,

Please keep in mind that the command prompt cannot work with Windows Installer properties, but indeed it works with environment variables. Also, from the command prompt you cannot copy a file to a folder that does not exist, that folder should be created first.

So, in order to create a folder from command line you can use the mkdir command.

If you want to use the value of a property in a BAT file that is executed as a custom action in Advanced Installer, you can configure it like in the example below:
  • BAT file content: copy %1 %2
    When you configure the custom action in your project, send the following command line to the BAT file:
    [AppDataFolder]apache-installer-status.cmd [APPDIR]apache-installer-status.cmd
    (two values that will replace the %1 and %2 notations)
Let us know if this helped, otherwise give us more details about your scenario.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”