First of your need to locate your aspnet_regiis.exe file which is located in one of the directories inside

%systemroot%\Microsoft.Net\Framework\

You can easily navigate to this folder using the WinBtn+R command (Run command) and pasting the above line in the run dialog.

The Framework folder contains your installed .NET versions.

Encrypt section

The below command will encrypt the section in the web config file which is located in the C:\Path\To\My\Folder\Contaning\MyWebConfig folder

C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis.exe -pef "connection
Strings" "C:\Path\To\My\Folder\Contaning\MyWebConfig"

Decrypt section

The below command will decrypt the section in the web config file which is located in the C:\Path\To\My\Folder\Contaning\MyWebConfig folder

C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis.exe -pdf "connection
Strings" "C:\Path\To\My\Folder\Contaning\MyWebConfig"

In case of "object not found" error run the command prompt with administrator privileges.