Changing web.config from the command line

I have an ASP.NET application running under IIS. I would like to be able to change one of the web.config values ​​in the application settings. I know that you can change it programmatically as described in this answer , but I am wondering if the same can be done from the command line.

IIS 7 Manager allows you to change application settings and connection strings (among other parameters). I hope there is a way to do the same through the command line for IIS 6 and / or 7.

+4
source share
2 answers

You can use powershell to modify web.config.

+3
source

You can use AppCmd.exe, which is included in IIS 7.0 and higher, in fact, the configuration editor in IIS Manager automatically generates a command line for you, for example, here it will set the test key for NewValue for / TestApp inside the Default website:

appcmd.exe set config "Default Web Site/TestApp" -section:appSettings /[key='test'].value:"NewValue" 
+4
source

All Articles