Appcmd set config appSettings - value with plus (+) is converted to space

I am trying to use appcmd to set appSetting in web.config, the value for appSetting contains the + character. When I run appcmd the appSetting is created but the + is converted to a space.

appcmd I run:

"C:\system32\inetsrv\appcmd.exe" set config "Default Web Site" /section:appSettings /+"[key='Test',value='++ ++']"


created by appSetting:

<add key="Test" value="     " />


I tried using% 2b instead of + in appcmd, it didn't work (it only converted to "b" in appSetting.

Does anyone know how I can get the + character included in appSetting when using appcmd?


source to share

1 answer

Have you tried using a unicode + value which is %u002b


"C:\system32\inetsrv\appcmd.exe" set config "Default Web Site" /section:appSettings 


You need to add an extra% sign to escape the% in the unicode value.

This should result in the Test key being +.




All Articles