Question: I've been cobbling some post installation steps but having difficulties, which I will go into. Please recommend a suitable, ideally native, process to run some custom steps post installation.

**Using:**
Visual Studio 2013 Ultimate

**Setup:**
vb.NET project & Visual Studio Instillation Project

**Test OS:**
Win 7 x64 with Admin

Currently, installer successfully install main application and extracts MS SQL Express + SQL scripts to a subdirectory. I have a batch file ("InstallSQL.bat") in the same directory, which silently installs SQL Express, and then executes the SQL scripts.

So how to best execute the "InstallSQL.bat" script, when Visual Studio doesn't support batch execution, from an installer Custom Action?

Methods I've tried:

1. Add cmd.exe (32-bit & 64-bit) + Installer Custom Action to launch the script, as per this [post](https://stackoverflow.com/questions/2414956/how-to-run-a-bat-file-during-installation). For some reason, the cmd.exe is executed with non-administrator credential, and SQL Setup fails.
2. Use a VBS script, to launch the batch script. VBS script does not run and error "A script required for this install to complete could not be run".

I am happy to consider an alternative approach to install SQL Express and run scripts, not based on a batch file. However, my custom batch file works perfectly when run manually i.e. not from the installer.

Please note, it needs to work on Windows XP and up, be location insensitive i.e. no static file locations and ideally, without using 3rd party utilities. This last requirement is weak.

Answer: 
With GNU sed:

```
sed -i 's|\[mysqld\]|&\nmax_allowed_packet = 128M|' /etc/my.cnf

```

---

> 
> `-i`: edit file "in place"
> 
> 
> `&`: refer to that portion which matched
> 
> 
> `\n`: new line
> 
> 
>
Thanks to @Cyrus

```
sed -i.bak 's|\[mysqld\]|&\nmax_allowed_packet = 128M|' /etc/my.cnf

```