Updating variables in file using the run powershell script step

I have an application which is deployed to azure through octopus deploy. It contains two steps, the first is to run a console application, IE trigger an EXE file through powershell. In the package where the exe exists there is also a config file which is used by the application. Is there a way to replace variables in this file before the exe is executed in the same way I can replace variables in file while using the deploy a nuget package step?

It sounds like you are wanting to substitute a variable in a file that's not in a package being deployed.

In that scenario, you could try specifying an absolute path in the substitute variables in files feature (i.e. C:\Octopus\text.txt), since this is only a feature of package steps, not script steps. You could potentially deploy an empty dummy package to utilize this feature.

Actually, what my scenario looks this :I have a package that I'm deploying but as one step of the process I want to run a script which invokes a console application (exe) (which is located in another package with the same id - not really my prefered approach but....) and that application has a config file in which I want to update some variables before executing the script.

What exactly do you mean when you say "deploy and empty dummy package"? Using a "deploy a package" to get hold of the configuration variables feature but not actually deploy a package?

I appreciate the breakdown you have provided in your most recent comment, it really helps out!

I originally mistakenly believed that there was no package being deployed at all, which is what led me to mention that you would need to deploy a blank package in order to access the necessary features you required.

However, since you are already deploying a package, you can enable the Config Transformation feature as previously mentioned within the package step, in addition to enabling the Custom installation directory feature to specify the location of the config file that is not contained within the package currently being deployed.

I hope this helps!

Please let me know if you require any further assistance, I'd be more than willing to help :)